feat: adjustments to nut

main
Ricard Illa 2023-04-10 21:25:17 +02:00
parent 86e438b6b8
commit be84734ee6
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
3 changed files with 14 additions and 1 deletions

View File

@ -206,6 +206,7 @@ all:
serial: "GBULZ2000030"
vendor: "CPS"
bus: "001"
pollinterval: 15
nut_mode: netserver
nut_admin_password: !vault |

View File

@ -6,12 +6,18 @@
- nut-server
when: ansible_distribution in ["Debian", "Ubuntu"]
- name: "set MAXAGE to 25 in /etc/nut/upsd.conf"
lineinfile:
dest: /etc/nut/upsd.conf
regexp: '^#\s*MAXAGE.*$'
line: 'MAXAGE 25'
- 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 }}"
{% for key, value in nut_device.config.items() %} {{ key }} = {{ value | to_json }}
{% endfor %}
- name: set up NUT user(s) to /etc/nut/upsd.users

View File

@ -11,6 +11,12 @@
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