Нема описа
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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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=/var/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 private key with public cert and intermediate + root CAs
  15. shell: cat /etc/ssl/private/wildcard_private.key /etc/ssl/certs/wildcard_combined.pem >
  16. /usr/lib/znc/znc.pem creates=/usr/lib/znc/znc.pem
  17. notify: restart znc
  18. - name: Ensure znc user and group can read cert
  19. file: path=/usr/lib/znc/znc.pem group=znc owner=znc mode=640
  20. notify: restart znc
  21. - name: Check for existing config file
  22. command: cat /usr/lib/znc/configs/znc.conf
  23. register: znc_config
  24. ignore_errors: True
  25. changed_when: False # never report as "changed"
  26. - name: Create znc config directory
  27. file: state=directory path=/usr/lib/znc/configs group=znc owner=znc
  28. - name: Copy znc configuration file into place
  29. template: src=usr_lib_znc_configs_znc.conf.j2 dest=/usr/lib/znc/configs/znc.conf owner=znc group=znc
  30. when: znc_config.rc != 0
  31. notify: restart znc
  32. - name: Set firewall rule for znc
  33. ufw: rule=allow port=6697 proto=tcp
  34. tags: ufw
  35. - name: Ensure znc is a system service
  36. service: name=znc state=restarted enabled=true