Add apcupsd_exporter for hypervisor
This commit is contained in:
parent
4c09b127c3
commit
e42a09747e
6 changed files with 62 additions and 4 deletions
|
@ -18,10 +18,6 @@ nameservers:
|
||||||
|
|
||||||
monitoring:
|
monitoring:
|
||||||
hosts:
|
hosts:
|
||||||
hypervisor-d.home.finn.io:
|
|
||||||
ansible_host: 10.5.1.123
|
|
||||||
home_network: true
|
|
||||||
|
|
||||||
http.home.finn.io:
|
http.home.finn.io:
|
||||||
ansible_host: 10.5.1.245
|
ansible_host: 10.5.1.245
|
||||||
home_network: true
|
home_network: true
|
||||||
|
@ -115,3 +111,9 @@ signal_bots:
|
||||||
hosts:
|
hosts:
|
||||||
signald-2:
|
signald-2:
|
||||||
home_network: true
|
home_network: true
|
||||||
|
|
||||||
|
hypervisors:
|
||||||
|
hosts:
|
||||||
|
hypervisor-d.home.finn.io:
|
||||||
|
ansible_host: 10.5.1.123
|
||||||
|
home_network: true
|
||||||
|
|
7
playbook-hypervisor.yaml
Normal file
7
playbook-hypervisor.yaml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
- hosts: hypervisors
|
||||||
|
vars:
|
||||||
|
ansible_user: root
|
||||||
|
roles:
|
||||||
|
- base
|
||||||
|
- monitoring
|
||||||
|
- hypervisor
|
7
roles/hypervisor/handlers/main.yaml
Normal file
7
roles/hypervisor/handlers/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
- name: systemctl daemon-reload
|
||||||
|
command: systemctl daemon-reload
|
||||||
|
|
||||||
|
- name: restart apcupsd_exporter
|
||||||
|
service:
|
||||||
|
name: apcupsd_exporter
|
||||||
|
state: restarted
|
1
roles/hypervisor/tasks/main.yml
Normal file
1
roles/hypervisor/tasks/main.yml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
- include_tasks: ups.yaml
|
27
roles/hypervisor/tasks/ups.yaml
Normal file
27
roles/hypervisor/tasks/ups.yaml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
- name: Install apcupsd
|
||||||
|
apt:
|
||||||
|
name: apcupsd
|
||||||
|
|
||||||
|
- name: download apcupsd_exporter
|
||||||
|
get_url:
|
||||||
|
url: https://git.janky.solutions/api/packages/JankySolutions/generic/infra-apcupsd_exporter/4c09b127c353cd57e6bc369f510fe516a0f65c0d/apcupsd_exporter
|
||||||
|
checksum: sha256:b17cc67d8ea9c6f1494b581a57a2315e33abf6dfb8edf2e1c14a50a0fb85e768
|
||||||
|
dest: /usr/local/bin/apcupsd_exporter
|
||||||
|
mode: "0755"
|
||||||
|
notify:
|
||||||
|
- restart apcupsd_exporter
|
||||||
|
|
||||||
|
- name: install apcupsd_exporter service
|
||||||
|
template:
|
||||||
|
src: apcupsd_exporter.service
|
||||||
|
dest: /etc/systemd/system/apcupsd_exporter.service
|
||||||
|
notify:
|
||||||
|
- systemctl daemon-reload
|
||||||
|
- restart apcupsd_exporter
|
||||||
|
|
||||||
|
- meta: flush_handlers
|
||||||
|
|
||||||
|
- name: enable apcupsd_exporter
|
||||||
|
service:
|
||||||
|
name: apcupsd_exporter
|
||||||
|
enabled: true
|
14
roles/hypervisor/templates/apcupsd_exporter.service
Normal file
14
roles/hypervisor/templates/apcupsd_exporter.service
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[Unit]
|
||||||
|
Description=apcupsd prometheus exporter
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=nobody
|
||||||
|
Group=nogroup
|
||||||
|
ExecStart=/usr/local/bin/apcupsd_exporter
|
||||||
|
Restart=always
|
||||||
|
RestartSec=30
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in a new issue