--- - name: install client for Debian / Ubuntu apt: name: nut-client when: ansible_distribution in ["Debian", "Ubuntu"] - name: set up /etc/nut/upsmon.conf blockinfile: path: /etc/nut/upsmon.conf block: | MONITOR {{ nut_device.name }}@{{ nut_host }} 1 upsmon {{ nut_upsmon_password }} {{ nut_types[nut_mode] }} - name: "set DEADTIME to 25 in /etc/nut/upsmon.conf" lineinfile: dest: /etc/nut/upsmon.conf regexp: 'DEADTIME.*$' line: 'DEADTIME 25' - name: start and enable nut-upsmon with openrc service: name: nut-upsmon runlevel: default state: started enabled: true when: ansible_distribution == "Alpine" - name: start and enable nut-monitor with systemd systemd: name: nut-monitor state: started enabled: true when: ansible_distribution in ["Debian", "Ubuntu", "Archlinux"]