2022-06-03 03:39:23 +00:00
|
|
|
---
|
|
|
|
# tasks file for nut
|
|
|
|
- name: Install os-specific packages
|
|
|
|
include_tasks: "{{ ansible_os_family | lower }}.yml"
|
|
|
|
|
|
|
|
- name: Enable standalone mode for Nut
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/nut/nut.conf
|
|
|
|
regexp: '^MODE='
|
2022-12-03 09:06:05 +00:00
|
|
|
line: MODE=netserver
|
2022-06-03 03:39:23 +00:00
|
|
|
notify: restart nut-server
|
|
|
|
|
2023-02-18 18:46:35 +00:00
|
|
|
# List of connected ups
|
2022-06-03 03:39:23 +00:00
|
|
|
- name: Copy ups.conf
|
|
|
|
template:
|
|
|
|
src: ups.conf.j2
|
|
|
|
dest: /etc/nut/ups.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart nut-server
|
2022-12-03 09:06:05 +00:00
|
|
|
|
2023-02-18 18:46:35 +00:00
|
|
|
# Service that communicate with UPSs
|
2022-12-03 09:06:05 +00:00
|
|
|
- name: Copy upsd.conf
|
|
|
|
template:
|
|
|
|
src: upsd.conf.j2
|
|
|
|
dest: /etc/nut/upsd.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart nut-server
|
2023-02-18 18:46:35 +00:00
|
|
|
|
|
|
|
# List of users allowed to communicate with upsd through network
|
|
|
|
- name: Copy upsd.users
|
|
|
|
template:
|
|
|
|
src: upsd.users.j2
|
|
|
|
dest: /etc/nut/upsd.users
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart nut-server
|
|
|
|
|
|
|
|
# Nut mode
|
|
|
|
- name: Copy nut.conf
|
|
|
|
template:
|
|
|
|
src: nut.conf.j2
|
|
|
|
dest: /etc/nut/nut.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart nut-server
|
|
|
|
|
|
|
|
# Service that interact with upsd to act
|
|
|
|
- name: Copy upsmon.conf
|
|
|
|
template:
|
|
|
|
src: upsmon.conf.j2
|
|
|
|
dest: /etc/nut/upsmon.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2023-03-22 04:50:01 +00:00
|
|
|
notify: restart nut-monitor
|