nut and acme working

This commit is contained in:
2024-01-11 18:15:16 +13:00
parent ba7cda511e
commit c6755e8d97
19 changed files with 287 additions and 70 deletions

View File

@ -0,0 +1,5 @@
- name: Restart nut-monitor
when: not nut_monitor_started.changed
ansible.builtin.service:
name: nut-monitor.service
state: restarted

View File

@ -6,18 +6,32 @@
owner: root
group: nut
mode: '0640'
notify:
- Restart nut-monitor
- name: Ensure nut-monitor systemd drop in directory exists
when: not ( nut_client_local_server | default(true) )
ansible.builtin.file:
path: /etc/systemd/system/nut-monitor.service.d
state: directory
owner: root
group: root
mode: '0755'
- name: Copy nut-monitor systemd drop in file
when: not ( nut_client_local_server | default(true) )
ansible.builtin.template:
ansible.builtin.copy:
src: nut-monitor_override.conf
dest: /etc/systemd/system/nut-monitor.service.d/override.conf
owner: root
group: root
mode: '0644'
notify:
- Restart nut-monitor
- name: Start and enable nut-monitor
ansible.builtin.service:
name: nut-monitor
state: restarted
name: nut-monitor.service
state: started
enabled: true
register: nut_monitor_started

View File

@ -1,6 +1,6 @@
# File configured by Ansible playbook
# Configuration reference:
# https://man.archlinux.org/man/upsmon.conf.5
# Reference documentation:
# https://networkupstools.org/docs/man/upsmon.conf.html
{% for ups in nut_client_ups_devices %}
{% if ups.type == 'primary' %}
@ -21,13 +21,13 @@ HOSTSYNC {{ nut_client_hostsync | default('30') }}
POLLFREQALERT 5
POLLFREQ 5
MINSUPPLIES {{ nut_client_min_supplies | default('1') }}
CERTPATH /usr/ssl/certs
CERTPATH /etc/ssl/certs
FORCESSL 1
CERTVERIFY 1
NOTIFYCMD {{ nut_client_notify_cmd | default('/usr/bin/notify-send') }}
{% for message in nut_client_notify_messages %}
NOTIFYCMD "{{ nut_client_notify_cmd | default('/usr/bin/notify-send') }}"
{% for message in (nut_client_notify_messages | default([])) %}
NOTIFYMSG {{ message.name }} {{ message.message }}
{% endfor %}
{% for notify in nut_client_notify_flags %}
{% for notify in (nut_client_notify_flags | default([])) %}
NOTIFYFLAG {{ notify.name }} {{ notify.flags }}
{% endfor %}