Adding ucode & UPS definitions to IAC

This commit is contained in:
DarkFeather 2023-12-21 12:58:32 -06:00
parent e244895552
commit 1ca0272031
Signed by: DarkFeather
GPG Key ID: 1CC1E3F4ED06F296
9 changed files with 66 additions and 10 deletions

View File

@ -44,21 +44,18 @@ all:
ip: 10.0.1.2 ip: 10.0.1.2
mac: B8:27:EB:B6:AA:0C mac: B8:27:EB:B6:AA:0C
static: true static: true
Node0:
ipinterface: enp1s0f0
ip: 10.0.1.4
mac: DE:8B:9E:19:55:1D
tap: true
Node1: Node1:
ipinterface: enp1s0 ipinterface: enp1s0
ip: 10.0.1.5 ip: 10.0.1.5
mac: FA:EC:43:87:4D:2D mac: FA:EC:43:87:4D:2D
tap: true tap: true
ups: 'aps'
Node2: Node2:
ipinterface: enp1s0 ipinterface: enp1s0
ip: 10.0.1.7 ip: 10.0.1.7
mac: 56:02:ef:2c:1f:7c mac: 56:02:ef:2c:1f:7c
tap: true tap: true
ups: 'cyberpower'
Node3: Node3:
ipinterface: enp1s0 ipinterface: enp1s0
ip: 10.0.1.8 ip: 10.0.1.8
@ -123,7 +120,6 @@ all:
- '-drive format=raw,index=0,media=disk,file=/dev/sdb' - '-drive format=raw,index=0,media=disk,file=/dev/sdb'
- '-drive format=raw,index=0,media=disk,file=/dev/sdc' - '-drive format=raw,index=0,media=disk,file=/dev/sdc'
- '-drive format=raw,index=0,media=disk,file=/dev/sdd' - '-drive format=raw,index=0,media=disk,file=/dev/sdd'
geth_hubs: # 10.0.1.32/28 geth_hubs: # 10.0.1.32/28
vars: vars:
motion_enabled: yes motion_enabled: yes
@ -263,7 +259,7 @@ all:
Tachikoma: Tachikoma:
ip: 10.0.1.72 ip: 10.0.1.72
mac: 90:0f:0c:1a:d3:23 mac: 90:0f:0c:1a:d3:23
Dedsec: DedSec:
ip: 10.0.1.73 ip: 10.0.1.73
mac: 34:F6:4B:36:12:8F mac: 34:F6:4B:36:12:8F
# dhcp build space: 10.0.1.224/27 # dhcp build space: 10.0.1.224/27
@ -278,6 +274,7 @@ all:
Charon: Charon:
ip: 10.0.2.4 ip: 10.0.2.4
mac: 64:52:99:14:28:2B mac: 64:52:99:14:28:2B
Skitarii-1: # CanoptekAleph: physical, no network
CanoptekBek:
ip: 10.0.2.5 ip: 10.0.2.5
mac: 40:9F:38:95:06:34 mac: 40:9F:38:95:06:34

View File

@ -57,7 +57,7 @@
roles: roles:
- Geth-Hub - Geth-Hub
- hosts: Node0 - hosts: Node1,Node2,Node3
order: sorted order: sorted
serial: "{{ threads | default('16') }}" serial: "{{ threads | default('16') }}"
gather_facts: true gather_facts: true

View File

@ -0,0 +1,2 @@
check program cyberpower with path "/etc/monit.d/scripts/check-cyberpower"
if status != 0 for 5 times within 5 cycles then exec "/etc/monit.d/scripts/critical Host is on UPS power!"

View File

@ -1 +1,2 @@
include "/etc/monit.d/checks/system" include "/etc/monit.d/checks/system"
include "/etc/monit.d/checks/cyberpower"

View File

@ -0,0 +1,6 @@
#!/bin/bash
if [ `pwrstat -status | sed 's/^\s\+//' | grep -E ^State | awk '{ print $2; }'` != 'Normal' ]; then
exit 2;
fi
exit 0

View File

@ -0,0 +1,13 @@
---
- name: AMD Ucode
become: yes
register: amd_ucode
package:
name: amd-ucode
state: present
- name: Rebuild grub
become: yes
when: amd_ucode.changed
command: grub-mkconfig -o /boot/grub/grub.cfg

View File

@ -0,0 +1,14 @@
---
- name: Install software
become: yes
package:
name: powerpanel
state: present
- name: Start service
become: yes
service:
name: pwrstatd.service
state: started
enabled: yes

View File

@ -0,0 +1,13 @@
---
- name: Intel Ucode
become: yes
register: intel_ucode
package:
name: intel-ucode
state: present
- name: Rebuild grub
become: yes
when: intel_ucode.changed
command: grub-mkconfig -o /boot/grub/grub.cfg

View File

@ -6,7 +6,6 @@
name: name:
- smartmontools - smartmontools
- hdparm - hdparm
- apcupsd
state: present state: present
- name: Set udev settings for drives - name: Set udev settings for drives
@ -31,4 +30,15 @@
when: udev_iosched.changed when: udev_iosched.changed
- include_tasks: amd.yml
when: "'AMD' in ansible_processor[1]"
- include_tasks: intel.yml
when: "'Intel' in ansible_processor"
- include_tasks: cyberpower.yml
when: "ups == 'cyberpower'"
- include_tasks: aps.yml
when: "ups == 'aps'"