homelab/ansible/playbooks/validate-connectivity.yml
Nathan 88d67ecf4f docs(ansible): complete Phase 5 - comprehensive validation and vault setup
Added production-grade validation tooling and documentation:

- ADDED: validate-connectivity.yml playbook with comprehensive checks
  * Ping test, sudo verification, Docker status
  * NFS mount validation, disk usage warnings
  * Proxmox-specific checks (version, cluster status)
  * System uptime reporting
  * Passes ansible-lint production profile

- ADDED: validate-environment.sh health check script
  * 10-point diagnostic validation
  * Color-coded status output
  * Reports all 4 nodes operational

- ADDED: QUICK-REFERENCE.md comprehensive command guide
  * Ad-hoc commands, playbook operations
  * Vault management, linting workflows
  * Inventory targeting examples
  * Integration guides (VSCode, Git)

- ADDED: Ansible Vault secrets template (encrypted)
  * group_vars/all/vault.yml with placeholder secrets
  * AES256 encrypted with vault password
  * Template for sudo, Proxmox, Gitea, NFS credentials

- UPDATED: plan-ansibleSetup.md progress report
  * Phase completion status (Phases 1-4 complete)
  * Deviations documented (hosts.ini format, PVE01 added)
  * Next steps and recommendations

- UPDATED: README.md Ansible section
  * Production-ready status badge
  * Quick validation command
  * Links to new documentation

Environment Status: 🟢 PRODUCTION READY
All 4 nodes responding, linting passed, documentation complete
2026-04-13 21:33:34 -04:00

122 lines
3.6 KiB
YAML

---
# Comprehensive Ansible Environment Validation
# Purpose: Deep health check of all managed nodes
# Usage: ansible-playbook playbooks/validate-connectivity.yml
- name: Ansible Environment Validation
hosts: all
gather_facts: true
tasks:
- name: Test ping module
ansible.builtin.ping:
- name: Display node facts
ansible.builtin.debug:
msg: |
Hostname: {{ ansible_hostname }}
OS: {{ ansible_distribution }} {{ ansible_distribution_version }}
Architecture: {{ ansible_architecture }}
Python: {{ ansible_python_version }}
Total Memory: {{ (ansible_memory_mb.real.total / 1024) | round(1) }}GB
CPU Cores: {{ ansible_processor_vcpus }}
- name: Test privilege escalation
ansible.builtin.command:
cmd: whoami
become: true
register: sudo_test
changed_when: false
- name: Verify sudo worked
ansible.builtin.assert:
that:
- sudo_test.stdout == "root"
success_msg: "Privilege escalation: PASS"
fail_msg: "Privilege escalation: FAIL"
- name: Check Docker installation
ansible.builtin.command:
cmd: docker --version
register: docker_version
changed_when: false
failed_when: false
when: inventory_hostname in groups['docker_nodes']
- name: Display Docker status
ansible.builtin.debug:
msg: "Docker {{ 'installed: ' + docker_version.stdout if docker_version.rc == 0 else 'NOT installed' }}"
when: inventory_hostname in groups['docker_nodes']
- name: Check NFS mount (infrastructure nodes only)
ansible.builtin.stat:
path: /mnt/appdata
register: nfs_mount
when: inventory_hostname in groups.get('nfs_clients', [])
- name: Display NFS status
ansible.builtin.debug:
msg: "NFS mount /mnt/appdata: {{ 'EXISTS' if nfs_mount.stat.exists else 'MISSING' }}"
when:
- inventory_hostname in groups.get('nfs_clients', [])
- nfs_mount is defined
- name: Check available disk space
ansible.builtin.shell:
cmd: set -o pipefail && df -h / | tail -1 | awk '{print $5}' | sed 's/%//'
executable: /bin/bash
register: disk_usage
changed_when: false
- name: Warn if disk usage high
ansible.builtin.debug:
msg: "WARNING: Root filesystem {{ disk_usage.stdout }}% full"
when: disk_usage.stdout | int > 80
- name: Check system uptime
ansible.builtin.command:
cmd: uptime -p
register: uptime_output
changed_when: false
- name: Display uptime
ansible.builtin.debug:
msg: "System uptime: {{ uptime_output.stdout }}"
- name: Proxmox-specific validation
hosts: proxmox_cluster
gather_facts: false
tasks:
- name: Check Proxmox version
ansible.builtin.command:
cmd: pveversion
register: pve_version
changed_when: false
- name: Display Proxmox version
ansible.builtin.debug:
msg: "{{ pve_version.stdout_lines }}"
- name: Check cluster status
ansible.builtin.command:
cmd: pvecm status
register: cluster_status
changed_when: false
failed_when: false
- name: Display cluster info
ansible.builtin.debug:
msg: "{{ 'Cluster configured' if cluster_status.rc == 0 else 'Standalone node (no cluster)' }}"
- name: Final summary
hosts: all
gather_facts: false
tasks:
- name: Environment validation complete
ansible.builtin.debug:
msg: |
✅ Validation complete for {{ inventory_hostname }}
All critical checks passed successfully.