Açıklama Yok
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.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 certificate renwal cron job
  21. lineinfile: dest=/etc/cron.monthly/letsencrypt-renew state=present
  22. line="cat /etc/letsencrypt/live/{{ domain }}/{privkey,fullchain}.pem > /usr/lib/znc/znc.pem; chown znc.znc /usr/lib/znc/znc.pem; chmod 640 /usr/lib/znc/znc.pem; service znc restart"
  23. insertafter="EOF"
  24. - name: Ensure znc user and group can read cert
  25. file: path=/usr/lib/znc/znc.pem group=znc owner=znc mode=640
  26. notify: restart znc
  27. - name: Check for existing config file
  28. command: cat /usr/lib/znc/configs/znc.conf
  29. register: znc_config
  30. ignore_errors: True
  31. changed_when: False # never report as "changed"
  32. - name: Create znc config directory
  33. file: state=directory path=/usr/lib/znc/configs group=znc owner=znc
  34. - name: Copy znc configuration file into place
  35. template: src=usr_lib_znc_configs_znc.conf.j2 dest=/usr/lib/znc/configs/znc.conf owner=znc group=znc
  36. when: znc_config.rc != 0
  37. notify: restart znc
  38. - name: Set firewall rule for znc
  39. ufw: rule=allow port=6697 proto=tcp
  40. tags: ufw
  41. - name: Ensure znc is a system service
  42. service: name=znc state=restarted enabled=true