Feat(nut): configure ups, upsmon, upsd et nut
This commit is contained in:
parent
558530e16e
commit
051a1cad9d
1
home.yml
1
home.yml
@ -5,6 +5,7 @@
|
||||
vars_files:
|
||||
- vars/users.yml
|
||||
- vars/home.yml
|
||||
- vars/nas_secrets.yml
|
||||
- vars/nas.yml
|
||||
|
||||
pre_tasks:
|
||||
|
@ -1,8 +1,23 @@
|
||||
---
|
||||
# defaults file for nut
|
||||
nut_mode: "standalone"
|
||||
upsd_users:
|
||||
- name: upsmonitor
|
||||
password: upsmonitorpass
|
||||
type: master
|
||||
|
||||
upss:
|
||||
- name: fooUps
|
||||
- name: fooUPS
|
||||
driver: usbhid-ups
|
||||
port: auto
|
||||
desc: "Foo UPS"
|
||||
vendorid: 1111
|
||||
productid: 1111
|
||||
|
||||
upsmon_servers:
|
||||
- ups_name: fooUPS
|
||||
address: localhost
|
||||
user: upsmonitor
|
||||
password: upsmonitorpass
|
||||
type: "master"
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
line: MODE=netserver
|
||||
notify: restart nut-server
|
||||
|
||||
# List of connected ups
|
||||
- name: Copy ups.conf
|
||||
template:
|
||||
src: ups.conf.j2
|
||||
@ -19,6 +20,7 @@
|
||||
mode: 0644
|
||||
notify: restart nut-server
|
||||
|
||||
# Service that communicate with UPSs
|
||||
- name: Copy upsd.conf
|
||||
template:
|
||||
src: upsd.conf.j2
|
||||
@ -27,3 +29,33 @@
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart nut-server
|
||||
|
||||
# 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
|
||||
notify: restart nut-server
|
||||
|
1
roles/nut/templates/nut.conf.j2
Normal file
1
roles/nut/templates/nut.conf.j2
Normal file
@ -0,0 +1 @@
|
||||
MODE={{ nut_mode }}
|
@ -4,4 +4,7 @@ maxretry = 3
|
||||
[{{ ups.name }}]
|
||||
driver = {{ ups.driver }}
|
||||
port = {{ ups.port }}
|
||||
desc = {{ ups.desc }}
|
||||
vendorid = {{ ups.vendorid }}
|
||||
productid = {{ ups.productid }}
|
||||
{% endfor %}
|
||||
|
6
roles/nut/templates/upsd.users.j2
Normal file
6
roles/nut/templates/upsd.users.j2
Normal file
@ -0,0 +1,6 @@
|
||||
{% for user in upsd_users %}
|
||||
[{{ user.name }}]
|
||||
password = {{ user.password}}
|
||||
upsmon {{ user.type }}
|
||||
|
||||
{% endfor %}
|
24
roles/nut/templates/upsmon.conf.j2
Normal file
24
roles/nut/templates/upsmon.conf.j2
Normal file
@ -0,0 +1,24 @@
|
||||
{% for server in upsmon_servers %}
|
||||
MONITOR {{ server.ups_name }}@{{ server.address}} 1 {{ server.user }} {{ server.password }} "{{ server.type }}"
|
||||
{% endfor %}
|
||||
|
||||
MINSUPPLIES 1
|
||||
|
||||
FINALDELAY 5
|
||||
SHUTDOWNCMD "/sbin/shutdown -h +0"
|
||||
------------------------------------------------
|
||||
# POLLFREQ <n>
|
||||
# Fréquence d'interrogation en secondes en fonctionnement normal de l'onduleur.
|
||||
# La valeur par défaut est de 5 secondes.
|
||||
POLLFREQ 5
|
||||
------------------------------------------------
|
||||
# POLLFREQALERT <n>
|
||||
# Fréquence d'interrogation en secondes pendant que l'onduleur est sur batterie.
|
||||
# La valeur par défaut est de 5 secondes.
|
||||
POLLFREQALERT 5
|
||||
------------------------------------------------
|
||||
HOSTSYNC 15
|
||||
DEADTIME 15
|
||||
POWERDOWNFLAG /etc/killpower
|
||||
RBWARNTIME 43200
|
||||
NOCOMMWARNTIME 300
|
14
vars/nas.yml
14
vars/nas.yml
@ -14,14 +14,26 @@ pihole_ip: 192.168.2.202
|
||||
|
||||
# Nut
|
||||
nut_mode: "netserver"
|
||||
upsd_users:
|
||||
- name: upsmonitor
|
||||
password: "{{ ups_user_password }}"
|
||||
type: master
|
||||
|
||||
upss:
|
||||
- name: eaton650
|
||||
driver: usbhid-ups
|
||||
port: auto
|
||||
vendorid: "0463"
|
||||
poductid: "FFFF"
|
||||
productid: "FFFF"
|
||||
desc: "UPS bureau"
|
||||
|
||||
upsmon_servers:
|
||||
- ups_name: fooUPS
|
||||
address: localhost
|
||||
user: upsmonitor
|
||||
password: "{{ ups_user_password }}"
|
||||
type: "master"
|
||||
|
||||
# minidlna
|
||||
minidlna_friendly_name: "Nas dlna"
|
||||
minidlna_media_dir: /mnt/DocNas/Commun/musique/
|
||||
|
7
vars/nas_secrets.yml
Normal file
7
vars/nas_secrets.yml
Normal file
@ -0,0 +1,7 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
62323338353830396465343361333965643662633066633137313939363934353430633662336134
|
||||
6265363735393134646561333137376430646362303264370a353861636430613264336238306439
|
||||
65343362323638333736363164333665393965363539643463663936656239396438663139393862
|
||||
6435396666663066620a386665313135613863616437386433616662396638646265663465633834
|
||||
38346436383033613338393536326536393230633866666565393137333430623839623965623761
|
||||
3934636264626337653762386531353861633338343364643335
|
Loading…
Reference in New Issue
Block a user