1
0
Fork 0

Compare commits

..

2 Commits

Author SHA1 Message Date
Massaki Archambault 72cf4f794a add node_exporter 2024-09-19 00:14:05 -04:00
Massaki Archambault 52e2574efa tweak NUT 2024-09-15 18:12:43 -04:00
14 changed files with 48 additions and 18 deletions

View File

@ -282,13 +282,13 @@ homeassistant:
nut_server: nut_server:
ansible_host: usbip ansible_host: usbip
ups: ups:
liebert-ps1: liebert-psi:
driver: usbhid-ups driver: usbhid-ups
vendorid: "10af" vendorid: "10af"
productid: "0001" productid: "0001"
nut_client: nut_client:
ups: liebert-ps1 ups: liebert-psi
sched: sched:
# How many seconds we are allowed to run on battery # How many seconds we are allowed to run on battery
on_bat: 300 on_bat: 300 # 5 minutes

17
hosts
View File

@ -19,10 +19,10 @@ all:
router-0: router-0:
ansible_host: 192.168.10.10 ansible_host: 192.168.10.10
nut_client: nut_client:
ups: liebert-ps1 ups: liebert-psi
sched: sched:
# We want to shutdown this server last # We want to shutdown this server last
on_bat: 3600 on_bat: 10800
server-0: server-0:
ansible_host: 192.168.10.11 ansible_host: 192.168.10.11
vfio_pci_ids: vfio_pci_ids:
@ -34,22 +34,15 @@ all:
- '10de:13c2' # NVIDIA Corporation GM204 [GeForce GTX 970] - '10de:13c2' # NVIDIA Corporation GM204 [GeForce GTX 970]
- '10de:13f1' # VGA compatible controller [0300]: NVIDIA Corporation GM204GL [Quadro M4000] - '10de:13f1' # VGA compatible controller [0300]: NVIDIA Corporation GM204GL [Quadro M4000]
nut_client: nut_client:
ups: liebert-ps1 ups: liebert-psi
sched: sched:
# We want to shutdown this server quick # We want to shutdown this server quick
on_bat: 10 on_bat: 15
bastion: bastion:
hosts: hosts:
bastion: bastion:
ansible_host: 192.168.20.10 ansible_host: 192.168.20.10
users_enable_sudo: false users_enable_sudo: false
plex:
hosts:
# plex:
# ansible_host: 192.168.20.31
# nfs_libraries:
# - 192.168.20.30:/mnt/pool0/media/Movies
# - 192.168.20.30:/mnt/pool0/media/Series
minecraft-server: minecraft-server:
# hosts: # hosts:
# minecraft-server: # minecraft-server:
@ -104,6 +97,8 @@ all:
hosts: hosts:
ubiquiti: ubiquiti:
ansible_host: 192.168.10.2 ansible_host: 192.168.10.2
satisfactory:
ansible_host: 192.168.20.31
children: children:
proxmox: proxmox:
bastion: bastion:

View File

@ -62,3 +62,9 @@
- hosts: cups - hosts: cups
roles: roles:
- cups - cups
# we want node metrics on the satisfactory server
- hosts: satisfactory
roles:
- docker
- prometheus.prometheus.node_exporter

2
requirements.yml Normal file
View File

@ -0,0 +1,2 @@
collections:
- name: prometheus.prometheus

View File

@ -35,6 +35,9 @@
include_tasks: user.yml include_tasks: user.yml
with_dict: '{{ users }}' with_dict: '{{ users }}'
- name: Configure monitoring
include_tasks: monitoring.yml
- name: Configure hostname - name: Configure hostname
hostname: hostname:
name: '{{ inventory_hostname }}' name: '{{ inventory_hostname }}'

View File

@ -0,0 +1,4 @@
- name: Import prometheus node_exporter role
import_role:
name: prometheus.prometheus.node_exporter
when: ansible_virtualization_role == 'host'

View File

@ -1,5 +1,5 @@
# TODO: setup credentials # TODO: setup credentials
MONITOR {{ nut_client.ups }}@{{ hostvars[nut_server.ansible_host]['ansible_default_ipv4']['address'] }} 1 monuser admin secondary MONITOR {{ nut_client.ups }}@{{ hostvars[nut_server.ansible_host]['ansible_default_ipv4']['address'] }} 1 monuser admin slave
MINSUPPLIES 1 MINSUPPLIES 1

View File

@ -1 +1,2 @@
#MAXAGE 15
LISTEN 0.0.0.0 3493 LISTEN 0.0.0.0 3493

View File

@ -1,4 +1,4 @@
# TODO: setup credentials # TODO: setup credentials
[monuser] [monuser]
password = admin password = admin
upsmon secondary upsmon slave

View File

@ -15,3 +15,7 @@
name: nut-monitor name: nut-monitor
enabled: true enabled: true
state: restarted state: restarted
- name: Reload udev
ansible.builtin.command:
cmd: "udevadm control --reload"

View File

@ -50,3 +50,10 @@
- Restart nut-server - Restart nut-server
- Restart nut-client - Restart nut-client
- Restart nut-monitor - Restart nut-monitor
- name: Configure NUT udev rules
template:
src: 62-nut-usbups.rules
dest: /etc/udev/rules.d/62-nut-usbups.rules
notify:
- Reload udev

View File

@ -0,0 +1,7 @@
SUBSYSTEM!="usb", GOTO="nut-usbups_rules_end"
{% for name, config in nut_server.ups.items() %}
ACTION=="add|change", SUBSYSTEM=="usb|usb_device", SUBSYSTEMS=="usb|usb_device", ATTR{idVendor}=="{{ config.vendorid }}", ATTR{idProduct}=="{{ config.productid }}", MODE="664", GROUP="nut", RUN+="/sbin/upsdrvctl stop; /sbin/upsdrvctl start"
{% endfor %}
LABEL="nut-usbups_rules_end"

View File

@ -1,4 +1,5 @@
maxretry = 3 maxretry = 3
pollinterval = 2
{% for name, config in nut_server.ups.items() %} {% for name, config in nut_server.ups.items() %}
[{{ name }}] [{{ name }}]

View File

@ -1,4 +1,4 @@
# TODO: setup credentials # TODO: setup credentials
{% for name in nut_server.ups.keys() %} {% for name in nut_server.ups.keys() %}
MONITOR {{ name }}@localhost 1 monuser admin primary MONITOR {{ name }}@localhost 1 monuser admin master
{% endfor %} {% endfor %}