- name: Template out ups.conf ansible.builtin.template: dest: /etc/nut/ups.conf group: root mode: '0644' owner: root src: ups.conf.j2 trim_blocks: true notify: - Restart nut-driver-enumerator - name: Template out upsd.conf ansible.builtin.template: dest: /etc/nut/upsd.conf group: nut mode: '0640' owner: root src: upsd.conf.j2 trim_blocks: true notify: - Restart nut-server - name: Template out upsd.users ansible.builtin.template: dest: /etc/nut/upsd.users group: nut mode: '0640' owner: root src: upsd.users.j2 trim_blocks: true notify: - Restart nut-server - name: Open nut server firewall port (UFW) community.general.ufw: rule: allow to_ip: "{{ nut_server_listen_address | string }}" to_port: "{{ nut_server_listen_port | string }}" proto: tcp comment: "NUT server" - name: Chown nut server cert to nut user ansible.builtin.file: group: nut mode: '0600' owner: nut path: "{{ nut_server_certificate_file }}" notify: - Restart nut-server - name: Start and enable nut-driver-enumerator ansible.builtin.service: name: nut-driver-enumerator.service state: started enabled: true register: nut_driver_enumerator_started - name: Start and enable nut-server ansible.builtin.service: name: nut-server.service state: started enabled: true register: nut_server_started - name: Start and enable nut targets ansible.builtin.service: name: "{{ item }}" state: started enabled: true loop: - nut-driver.target - nut.target