diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index 57b5a07..a4bf5bb 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -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 diff --git a/ansible/inventory/group_vars/nut_clients/nut_clients.yaml b/ansible/inventory/group_vars/nut_clients/nut_clients.yaml new file mode 100644 index 0000000..366edc8 --- /dev/null +++ b/ansible/inventory/group_vars/nut_clients/nut_clients.yaml @@ -0,0 +1,2 @@ +nut_packages: + nut \ No newline at end of file diff --git a/ansible/inventory/group_vars/nut_servers/nut_servers.yaml b/ansible/inventory/group_vars/nut_servers/nut_servers.yaml new file mode 100644 index 0000000..366edc8 --- /dev/null +++ b/ansible/inventory/group_vars/nut_servers/nut_servers.yaml @@ -0,0 +1,2 @@ +nut_packages: + nut \ No newline at end of file diff --git a/ansible/inventory/host_vars/hv00.balsillie.house/nut.yaml b/ansible/inventory/host_vars/hv00.balsillie.house/nut.yaml new file mode 100644 index 0000000..e128e38 --- /dev/null +++ b/ansible/inventory/host_vars/hv00.balsillie.house/nut.yaml @@ -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 \ No newline at end of file diff --git a/ansible/inventory/host_vars/kube01/kube01.yaml b/ansible/inventory/host_vars/kube00/kube00.yaml similarity index 100% rename from ansible/inventory/host_vars/kube01/kube01.yaml rename to ansible/inventory/host_vars/kube00/kube00.yaml diff --git a/ansible/inventory/host_vars/kube00/nut.yaml b/ansible/inventory/host_vars/kube00/nut.yaml new file mode 100644 index 0000000..98feedb --- /dev/null +++ b/ansible/inventory/host_vars/kube00/nut.yaml @@ -0,0 +1,8 @@ +--- + +nut_client_server_list: + - host: hv00.balsillie.house + port: 3493 + ssl: true + username: "{{ nut_client_username }}" + password: "{{ nut_client_password }}" diff --git a/ansible/inventory/host_vars/kube02/kube02.yaml b/ansible/inventory/host_vars/kube02/kube02.yaml deleted file mode 100644 index 11755c0..0000000 --- a/ansible/inventory/host_vars/kube02/kube02.yaml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/ansible/inventory/host_vars/kube03/kube03.yaml b/ansible/inventory/host_vars/kube03/kube03.yaml deleted file mode 100644 index d92a7ef..0000000 --- a/ansible/inventory/host_vars/kube03/kube03.yaml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/ansible/inventory/host_vars/localhost_bak/localhost.yaml b/ansible/inventory/host_vars/localhost_bak/localhost.yaml deleted file mode 100644 index 572d2e1..0000000 --- a/ansible/inventory/host_vars/localhost_bak/localhost.yaml +++ /dev/null @@ -1,3 +0,0 @@ -ebs_zfs_storage_classes: - - name: ssd-zfs - dataset: ssd/data/open-ebs \ No newline at end of file diff --git a/ansible/inventory/inventory.yaml b/ansible/inventory/inventory.yaml index c23e7f5..67b1e64 100644 --- a/ansible/inventory/inventory.yaml +++ b/ansible/inventory/inventory.yaml @@ -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: diff --git a/ansible/playbooks/nut.yaml b/ansible/playbooks/nut.yaml new file mode 100644 index 0000000..81eddd5 --- /dev/null +++ b/ansible/playbooks/nut.yaml @@ -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 diff --git a/ansible/playbooks/roles b/ansible/playbooks/roles new file mode 120000 index 0000000..7b9ade8 --- /dev/null +++ b/ansible/playbooks/roles @@ -0,0 +1 @@ +../roles/ \ No newline at end of file diff --git a/ansible/roles/k8s_network/files/cluster.balsillie.house/calico_ip_reservation.yaml b/ansible/roles/k8s_network/files/cluster.balsillie.house/calico_ip_reservation.yaml index 04b5714..3516956 100644 --- a/ansible/roles/k8s_network/files/cluster.balsillie.house/calico_ip_reservation.yaml +++ b/ansible/roles/k8s_network/files/cluster.balsillie.house/calico_ip_reservation.yaml @@ -35,5 +35,7 @@ spec: # 10.208.240.6 # 2400:8907:e002:7c10:ffff:ffff:ffff:f006 # -# Turn: -# \ No newline at end of file +# Coturn: +# 10.208.240.7 +# 2400:8907:e002:7c10:ffff:ffff:ffff:f007 +# diff --git a/ansible/roles/nut_server/tasks/main.yaml b/ansible/roles/nut_server/tasks/main.yaml new file mode 100644 index 0000000..94efce4 --- /dev/null +++ b/ansible/roles/nut_server/tasks/main.yaml @@ -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 diff --git a/ansible/roles/nut_server/templates/ups.conf.j2 b/ansible/roles/nut_server/templates/ups.conf.j2 new file mode 100644 index 0000000..05e7f76 --- /dev/null +++ b/ansible/roles/nut_server/templates/ups.conf.j2 @@ -0,0 +1,5 @@ +{% for ups in ups_devices %} +[ups{{ loop.index }}] + driver = {{ ups.driver }} + port = {{ ups.port }} +{% endfor %} \ No newline at end of file diff --git a/ansible/roles/nut_server/templates/upsd.conf.j2 b/ansible/roles/nut_server/templates/upsd.conf.j2 new file mode 100644 index 0000000..e69de29