Ei kuvausta
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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # more or less as per http://wiki.znc.in/Running_ZNC_as_a_system_daemon
  2. - name: Install znc dependencies
  3. apt: pkg={{ item }} state=installed
  4. with_items:
  5. - automake
  6. - build-essential
  7. - checkinstall
  8. - g++
  9. - libperl-dev
  10. - libsasl2-dev
  11. - libssl-dev
  12. - libtool
  13. - openssl
  14. - pkg-config
  15. - python3-dev
  16. - swig
  17. tags:
  18. - dependencies
  19. - name: Download znc release
  20. get_url: url=http://znc.in/releases/archive/znc-{{ znc_version }}.tar.gz dest=/root/znc-{{ znc_version }}.tar.gz
  21. - name: Decompress znc source
  22. unarchive: src=/root/znc-{{ znc_version }}.tar.gz
  23. dest=/root copy=no
  24. creates=/root/znc-{{ znc_version }}/configure
  25. - name: Build and install znc
  26. shell: ./configure --enable-python && make && make install executable=/bin/bash chdir=/root/znc-{{ znc_version }} creates=/usr/local/bin/znc
  27. notify: restart znc
  28. - name: Create znc group
  29. group: name=znc state=present
  30. - name: Create znc user
  31. user: name=znc state=present home=/var/lib/znc system=yes group=znc shell=/usr/sbin/nologin
  32. - name: Copy znc init file into place
  33. copy: src=etc_init.d_znc dest=/etc/init.d/znc mode=0755
  34. - name: Create a combined version of the private key with public cert and intermediate + root CAs
  35. shell: cat /etc/ssl/private/wildcard_private.key /etc/ssl/certs/wildcard_combined.pem >
  36. /var/lib/znc/znc.pem creates=/var/lib/znc/znc.pem
  37. notify: restart znc
  38. - name: Ensure znc user and group can read cert
  39. file: path=/var/lib/znc/znc.pem group=znc owner=znc mode=640
  40. notify: restart znc
  41. - name: Check for existing config file
  42. command: cat /var/lib/znc/configs/znc.conf
  43. register: znc_config
  44. ignore_errors: True
  45. changed_when: False # never report as "changed"
  46. - name: Create znc config directory
  47. file: state=directory path=/var/lib/znc/configs group=znc owner=znc
  48. - name: Copy znc configuration file into place
  49. template: src=var_lib_znc_configs_znc.conf.j2 dest=/var/lib/znc/configs/znc.conf owner=znc group=znc
  50. when: znc_config.rc != 0
  51. notify: restart znc
  52. - name: Set firewall rule for znc
  53. ufw: rule=allow port=6697 proto=tcp
  54. - name: Ensure znc is a system service
  55. service: name=znc state=started enabled=true