nut wip
This commit is contained in:
parent
9e07845208
commit
92df824252
@ -5,7 +5,6 @@ library = modules
|
||||
module_utils = module_utils
|
||||
display_skipped_hosts = false
|
||||
interpreter_python = auto_silent
|
||||
collections_paths = ./collections
|
||||
collections_path = ./collections
|
||||
roles_path = ./roles
|
||||
vault_password_file = ./vault_password
|
||||
|
@ -0,0 +1,2 @@
|
||||
nut_packages:
|
||||
nut
|
@ -0,0 +1,2 @@
|
||||
nut_packages:
|
||||
nut
|
@ -0,0 +1,7 @@
|
||||
nut_server_listen_address: 10.192.110.100
|
||||
nut_server_listen_port: 3493
|
||||
|
||||
nut_server_ups_devices:
|
||||
- name: APC 650
|
||||
driver: usbhid-ups
|
||||
port: auto
|
8
ansible/inventory/host_vars/kube00/nut.yaml
Normal file
8
ansible/inventory/host_vars/kube00/nut.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
|
||||
nut_client_server_list:
|
||||
- host: hv00.balsillie.house
|
||||
port: 3493
|
||||
ssl: true
|
||||
username: "{{ nut_client_username }}"
|
||||
password: "{{ nut_client_password }}"
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
ansible_host: kube02.balsillie.net
|
||||
ssh_public_key_string: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGOfsOJJJ34VT9mHv9moHQAQNTAok8sOr49rVTkIfDn9 ladmin@kube02.balsillie.net
|
||||
k8s_remove_control_plane_taint: true
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
ansible_host: kube03.balsillie.net
|
||||
ssh_public_key_string: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINFqYq3CcxziLbWfp/0VpO5uD/HyjiKTXD8t/dAS01Oq ladmin@kube00.balsillie.net
|
||||
k8s_remove_control_plane_taint: true
|
@ -1,3 +0,0 @@
|
||||
ebs_zfs_storage_classes:
|
||||
- name: ssd-zfs
|
||||
dataset: ssd/data/open-ebs
|
@ -1,16 +1,10 @@
|
||||
all:
|
||||
children:
|
||||
ups:
|
||||
hosts:
|
||||
ups00.balsillie.house:
|
||||
firewalls:
|
||||
children:
|
||||
opnsense:
|
||||
hosts:
|
||||
fw00.balsillie.net:
|
||||
openwrt:
|
||||
hosts:
|
||||
fw00.balsillie.house:
|
||||
router.balsillie.house:
|
||||
switches:
|
||||
hosts:
|
||||
sw00.balsillie.house:
|
||||
@ -19,59 +13,44 @@ all:
|
||||
wap00.balsillie.house:
|
||||
virtual_machines:
|
||||
hosts:
|
||||
kube01.balsillie.net:
|
||||
kube02.balsillie.net:
|
||||
kube03.balsillie.net:
|
||||
fw00.balsillie.net:
|
||||
fw00.balsillie.house:
|
||||
mp00.balsillie.house:
|
||||
win11.balsillie.house:
|
||||
bare_metal:
|
||||
hosts:
|
||||
ups00.balsillie.house:
|
||||
sw00.balsillie.house:
|
||||
wap00.balsillie.house:
|
||||
hv00.balsillie.house:
|
||||
hv00.balsillie.net:
|
||||
kube00.balsillie.house:
|
||||
lat5420.balsillie.house:
|
||||
lat7490.balsillie.house:
|
||||
sff.balsillie.house:
|
||||
servers:
|
||||
children:
|
||||
hypervisors:
|
||||
hosts:
|
||||
hv00.balsillie.net: # Hetzner
|
||||
hv00.balsillie.house: # vp2420
|
||||
hv01.balsillie.net: # 4U Rosewill
|
||||
k8s:
|
||||
children:
|
||||
k8s_control:
|
||||
hosts:
|
||||
kube01.balsillie.net:
|
||||
kube02.balsillie.net:
|
||||
kube03.balsillie.net:
|
||||
k8s_taint:
|
||||
hosts:
|
||||
kube01.balsillie.net:
|
||||
kube02.balsillie.net:
|
||||
kube03.balsillie.net:
|
||||
kube00.balsillie.house:
|
||||
k8s_worker:
|
||||
hosts:
|
||||
kube01.balsillie.net:
|
||||
kube02.balsillie.net:
|
||||
kube03.balsillie.net:
|
||||
kube00.balsillie.net:
|
||||
k8s_storage:
|
||||
hosts:
|
||||
kube01.balsillie.net:
|
||||
kube02.balsillie.net:
|
||||
kube03.balsillie.net:
|
||||
kube00.balsillie.net:
|
||||
nut_servers:
|
||||
hosts:
|
||||
hv00.balsillie.house:
|
||||
nut_clients:
|
||||
hosts:
|
||||
kube00.balsillie.house:
|
||||
workstations:
|
||||
children:
|
||||
arch:
|
||||
hosts:
|
||||
lat5420.balsillie.house:
|
||||
sff.balsillie.house:
|
||||
mp00.balsillie.house:
|
||||
windows:
|
||||
hosts:
|
||||
lat7490.balsillie.house:
|
||||
@ -83,19 +62,4 @@ all:
|
||||
desktops:
|
||||
hosts:
|
||||
sff.balsillie.house:
|
||||
mp00.balsillie.house:
|
||||
hetzner:
|
||||
hosts:
|
||||
fw00.balsillie.net:
|
||||
hv00.balsillie.net:
|
||||
kube01.balsillie.net:
|
||||
kube02.balsillie.net:
|
||||
kube03.balsillie.net:
|
||||
house:
|
||||
hosts:
|
||||
hv00.balsillie.house:
|
||||
fw00.balsillie.house:
|
||||
mp00.balsillie.house:
|
||||
win11.balsillie.house:
|
||||
lat5420.balsillie.house:
|
||||
sff.balsillie.house:
|
||||
mp00.balsillie.house:
|
||||
|
29
ansible/playbooks/nut.yaml
Normal file
29
ansible/playbooks/nut.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
- name: Install NUT
|
||||
hosts:
|
||||
- nut_servers
|
||||
- nut_clients
|
||||
become: true
|
||||
tasks:
|
||||
|
||||
- name: Install NUT packages
|
||||
when: ansible_facts['os_family'] == "Archlinux"
|
||||
community.general.pacman:
|
||||
name: "{{ nut_packages }}"
|
||||
state: latest
|
||||
update_cache: true
|
||||
upgrade: false
|
||||
|
||||
- name: Setup NUT servers
|
||||
gather_facts: true
|
||||
hosts: nut_servers
|
||||
become: true
|
||||
roles:
|
||||
- ssl_certificate
|
||||
- nut_server
|
||||
|
||||
- name: Setup NUT clients
|
||||
gather_facts: true
|
||||
hosts: nut_clients
|
||||
become: true
|
||||
roles:
|
||||
- nut_client
|
1
ansible/playbooks/roles
Symbolic link
1
ansible/playbooks/roles
Symbolic link
@ -0,0 +1 @@
|
||||
../roles/
|
@ -35,5 +35,7 @@ spec:
|
||||
# 10.208.240.6
|
||||
# 2400:8907:e002:7c10:ffff:ffff:ffff:f006
|
||||
#
|
||||
# Turn:
|
||||
#
|
||||
# Coturn:
|
||||
# 10.208.240.7
|
||||
# 2400:8907:e002:7c10:ffff:ffff:ffff:f007
|
||||
#
|
||||
|
57
ansible/roles/nut_server/tasks/main.yaml
Normal file
57
ansible/roles/nut_server/tasks/main.yaml
Normal file
@ -0,0 +1,57 @@
|
||||
- name: Template out ups.conf
|
||||
ansible.builtin.template:
|
||||
src: ups.conf.j2
|
||||
dest: /etc/nut/ups.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
|
||||
- name: Start and enable nut-enumerator
|
||||
ansible.builtin.service:
|
||||
name: nut-driver-enumerator
|
||||
state: restarted
|
||||
enabled: true
|
||||
|
||||
- name: Template out upsd.conf
|
||||
ansible.builtin.template:
|
||||
src: upsd.conf.j2
|
||||
dest: /etc/nut/upsd.conf
|
||||
owner: root
|
||||
group: nut
|
||||
mode: '0640'
|
||||
|
||||
- name: Template out upsd.users
|
||||
ansible.builtin.template:
|
||||
src: upsd.users.j2
|
||||
dest: /etc/nut/upsd.users
|
||||
owner: root
|
||||
group: nut
|
||||
mode: '0640'
|
||||
|
||||
- name: Open nut server firewall port
|
||||
community.general.ufw:
|
||||
rule: allow
|
||||
to_ip: "{{ nut_server_listen_address }}"
|
||||
to_port: "{{ nut_server_listen_port }}}}"
|
||||
proto: tcp
|
||||
comment: "NUT server"
|
||||
|
||||
- name: Start and enable nut-server
|
||||
ansible.builtin.service:
|
||||
name: nut-server
|
||||
state: restarted
|
||||
enabled: true
|
||||
|
||||
- name: Template out upsmon.conf
|
||||
ansible.builtin.template:
|
||||
src: upsmon.conf.j2
|
||||
dest: /etc/nut/upsmon.conf
|
||||
owner: root
|
||||
group: nut
|
||||
mode: '0640'
|
||||
|
||||
- name: Start and enable nut-monitor
|
||||
ansible.builtin.service:
|
||||
name: nut-monitor
|
||||
state: restarted
|
||||
enabled: true
|
5
ansible/roles/nut_server/templates/ups.conf.j2
Normal file
5
ansible/roles/nut_server/templates/ups.conf.j2
Normal file
@ -0,0 +1,5 @@
|
||||
{% for ups in ups_devices %}
|
||||
[ups{{ loop.index }}]
|
||||
driver = {{ ups.driver }}
|
||||
port = {{ ups.port }}
|
||||
{% endfor %}
|
0
ansible/roles/nut_server/templates/upsd.conf.j2
Normal file
0
ansible/roles/nut_server/templates/upsd.conf.j2
Normal file
Loading…
Reference in New Issue
Block a user