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 2.0KB

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