Brak opisu
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

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