ansible/roles/nut/tasks/upsmon.yml

34 lines
854 B
YAML
Raw Normal View History

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