No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

znc.yml 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # more or less as per http://wiki.znc.in/Running_ZNC_as_a_system_daemon
  2. - name: Install znc
  3. apt: pkg={{ item }} state=installed
  4. with_items:
  5. - znc
  6. - name: Create znc group
  7. group: name=znc state=present
  8. - name: Create znc user
  9. user: name=znc state=present home=/usr/lib/znc system=yes group=znc shell=/usr/sbin/nologin
  10. - name: Ensure pid directory exists
  11. file: state=directory path=/var/run/znc group=znc owner=znc
  12. - name: Copy znc service file into place
  13. copy: src=etc_systemd_system_znc.service dest=/etc/systemd/system/znc.service mode=0644
  14. - name: Create a combined version of the SSL private key and full certificate chain
  15. shell: cat /etc/letsencrypt/live/{{ domain }}/privkey.pem
  16. /etc/letsencrypt/live/{{ domain }}/fullchain.pem >
  17. /usr/lib/znc/znc.pem
  18. creates=/usr/lib/znc/znc.pem
  19. notify: restart znc
  20. - name: Update post-certificate-renewal task
  21. template:
  22. src: etc_letsencrypt_postrenew_znc.sh.j2
  23. dest: /etc/letsencrypt/postrenew/znc.sh
  24. owner: root
  25. group: root
  26. mode: 0755
  27. - name: Ensure znc user and group can read cert
  28. file: path=/usr/lib/znc/znc.pem group=znc owner=znc mode=640
  29. notify: restart znc
  30. - name: Check for existing config file
  31. command: cat /usr/lib/znc/configs/znc.conf
  32. register: znc_config
  33. ignore_errors: True
  34. changed_when: False # never report as "changed"
  35. - name: Create znc config directory
  36. file: state=directory path=/usr/lib/znc/configs group=znc owner=znc
  37. - name: Copy znc configuration file into place
  38. template: src=usr_lib_znc_configs_znc.conf.j2 dest=/usr/lib/znc/configs/znc.conf owner=znc group=znc
  39. when: znc_config.rc != 0
  40. notify: restart znc
  41. - name: Set firewall rule for znc
  42. ufw: rule=allow port=6697 proto=tcp
  43. tags: ufw
  44. - name: Ensure znc is a system service
  45. service: name=znc state=restarted enabled=true