ansible/roles/nut/tasks/upsd.yml

31 lines
730 B
YAML

---
- name: add UPS device(s) config to /etc/nut/ups.conf
blockinfile:
path: /etc/nut/ups.conf
block: |
[{{ nut_device.name }}]
{% for key, value in nut_device.config.items() %} {{ key }} = "{{ value }}"
{% endfor %}
- name: set up NUT user(s) to /etc/nut/upsd.users
blockinfile:
path: /etc/nut/upsd.users
block: |
[admin]
password = "{{ nut_admin_password }}"
actions = SET
instcmds = ALL
[upsmon]
password = "{{ nut_upsmon_password }}"
upsmon {{ nut_types[nut_mode] }}
- name: start and enable nut-upsd
service:
name: nut-upsd
runlevel: default
state: started
enabled: true
when: ansible_distribution == "Alpine"