feat(infra): Phase 3 & 4 completion, deploy AWX playbooks & Zabbix monitoring
This commit is contained in:
26
ansible/playbooks/daily_drift_audit.yml
Normal file
26
ansible/playbooks/daily_drift_audit.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
- name: Daily Infrastructure Health & Configuration Drift Audit
|
||||
hosts: all:!synology_nas
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Audit system time sync status
|
||||
ansible.builtin.command: timedatectl show -p NTPSynchronized --value
|
||||
register: time_sync
|
||||
changed_when: false
|
||||
failed_when: time_sync.stdout != "yes"
|
||||
|
||||
- name: Audit Zabbix Agent 2 service status
|
||||
ansible.builtin.command: systemctl is-active zabbix-agent2
|
||||
register: zabbix_status
|
||||
changed_when: false
|
||||
failed_when: zabbix_status.stdout != "active"
|
||||
|
||||
- name: Audit unified SSH key enrollment in authorized_keys
|
||||
ansible.builtin.shell: grep -q "snarfnet-automation-master@snarfnet.net" ~/.ssh/authorized_keys
|
||||
register: ssh_key_check
|
||||
changed_when: false
|
||||
failed_when: ssh_key_check.rc != 0
|
||||
|
||||
- name: Display host audit status
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ inventory_hostname }} ({{ ansible_host }}) [OK]: TimeSync={{ time_sync.stdout }}, Zabbix={{ zabbix_status.stdout }}, SSHKey=Verified"
|
||||
Reference in New Issue
Block a user