# more or less as per http://wiki.znc.in/Running_ZNC_as_a_system_daemon - name: Install znc apt: pkg={{ item }} state=installed with_items: - znc - name: Create a combined version of the private key with public cert and intermediate + root CAs shell: cat /etc/ssl/private/wildcard_private.key /etc/ssl/certs/wildcard_combined.pem > /usr/lib/znc/znc.pem creates=/usr/lib/znc/znc.pem notify: restart znc - name: Ensure znc user and group can read cert file: path=/usr/lib/znc/znc.pem group=znc owner=znc mode=640 notify: restart znc - name: Check for existing config file command: cat /usr/lib/znc/configs/znc.conf register: znc_config ignore_errors: True changed_when: False # never report as "changed" - name: Create znc config directory file: state=directory path=/usr/lib/znc/configs group=znc owner=znc - name: Copy znc configuration file into place template: src=usr_lib_znc_configs_znc.conf.j2 dest=/usr/lib/znc/configs/znc.conf owner=znc group=znc when: znc_config.rc != 0 notify: restart znc - name: Set firewall rule for znc ufw: rule=allow port=6697 proto=tcp tags: ufw - name: Ensure znc is a system service service: name=znc state=started enabled=true