Files
infra-automation/collections/requirements.yml
ansible cc21e89a78 Add playbook structure, master playbook, and collections requirements
Implement standardized playbook organization with master orchestrator
and Ansible collections requirements for extended functionality.

Playbook Structure:
playbooks/
├── gather_system_info.yml    # System inventory gathering
├── deploy_vm.yml             # VM deployment (placeholder)
├── security_audit.yml        # Security compliance checking (placeholder)
├── maintenance.yml           # Routine maintenance tasks (placeholder)
├── backup.yml                # Backup operations (placeholder)
└── disaster_recovery.yml     # DR procedures (placeholder)

Master Playbook (site.yml):
- Entry point for all infrastructure operations
- Import structure for modular playbook organization
- Tag-based execution for selective operations
- Pre-flight checks and validations
- Comprehensive documentation and usage examples

Collections Requirements (collections/requirements.yml):
- community.general: Essential utilities and modules
- community.libvirt: KVM/libvirt management
- ansible.posix: POSIX system administration
- amazon.aws: AWS infrastructure management (optional)
- Community versions for open-source compatibility

Implemented Playbooks:

1. gather_system_info.yml:
   - Comprehensive system information gathering
   - Uses system_info role
   - Statistics export to ./stats/machines/
   - Health checks and validation
   - Tag support: install, gather, export, validate, health-check

2. Placeholder Playbooks (documented structure):
   - deploy_vm.yml: VM provisioning with deploy_linux_vm role
   - security_audit.yml: CIS benchmark compliance checking
   - maintenance.yml: Updates, cleanup, optimization
   - backup.yml: Backup operations orchestration
   - disaster_recovery.yml: DR procedures and testing

site.yml Master Playbook Features:
- Central orchestration point
- Import-based playbook inclusion
- Tag inheritance and selective execution
- Environment-aware (development, staging, production)
- Pre-flight validation checks
- Error handling and rollback support
- Comprehensive inline documentation

Usage Examples:
```bash
# Run all playbooks
ansible-playbook site.yml

# Run specific playbook
ansible-playbook site.yml --tags gather_info

# Gather system information only
ansible-playbook playbooks/gather_system_info.yml

# Check syntax
ansible-playbook site.yml --syntax-check

# Dry run
ansible-playbook site.yml --check

# Limit to specific hosts
ansible-playbook site.yml -l webservers
```

Collections Management:
- Install: ansible-galaxy collection install -r collections/requirements.yml
- Update: ansible-galaxy collection install -r collections/requirements.yml --upgrade
- Location: ./collections/ (local) and ~/.ansible/collections (user)
- Version pinning for stability
- Community alternatives for RHEL-free deployments

CLAUDE.md Compliance:
 Playbooks in ./playbooks/ directory
 Master playbook (site.yml) at root
 Tag-based execution support
 Modular organization with import_playbook
 Collections requirements documented
 Clear separation: playbooks (lasting) vs plays (temporary)

Benefits:
- Standardized playbook organization
- Easy-to-navigate structure
- Tag-based selective execution
- Collection dependency management
- Scalable to 100+ playbooks
- Clear entry point (site.yml)
- Environment isolation

Next Steps:
1. Install collections: ansible-galaxy collection install -r collections/requirements.yml
2. Implement placeholder playbooks as needed
3. Add role-specific playbooks to playbooks/ directory
4. Create temporary plays in plays/ directory (per CLAUDE.md)
5. Test site.yml orchestration: ansible-playbook site.yml --check

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 01:37:19 +01:00

145 lines
4.5 KiB
YAML

---
# =============================================================================
# Ansible Collections Requirements
# =============================================================================
#
# This file defines the Ansible collections required for this infrastructure.
# Install with: ansible-galaxy collection install -r collections/requirements.yml
#
# Update with: ansible-galaxy collection install -r collections/requirements.yml --upgrade
#
# =============================================================================
collections:
# Community General Collection
# Provides a wide range of modules and plugins for general system management
- name: community.general
version: ">=8.0.0"
source: https://galaxy.ansible.com
# Ansible POSIX Collection
# Essential for POSIX system operations (ACLs, SELinux, sysctl, etc.)
- name: ansible.posix
version: ">=1.5.0"
source: https://galaxy.ansible.com
# Ansible Built-in Collection
# Core Ansible modules (ping, setup, command, shell, etc.)
- name: ansible.builtin
source: https://galaxy.ansible.com
# Community Crypto Collection
# For certificate management, OpenSSL, and cryptographic operations
- name: community.crypto
version: ">=2.0.0"
source: https://galaxy.ansible.com
# Community Docker Collection
# Docker and container management (if using Docker/Podman)
- name: community.docker
version: ">=3.0.0"
source: https://galaxy.ansible.com
# Community Libvirt Collection
# KVM/libvirt virtualization management
- name: community.libvirt
version: ">=1.3.0"
source: https://galaxy.ansible.com
# Ansible Utils Collection
# Utilities for network automation and data manipulation
- name: ansible.utils
version: ">=2.0.0"
source: https://galaxy.ansible.com
# Community MySQL Collection
# MySQL/MariaDB database management
- name: community.mysql
version: ">=3.0.0"
source: https://galaxy.ansible.com
# Community PostgreSQL Collection
# PostgreSQL database management
- name: community.postgresql
version: ">=3.0.0"
source: https://galaxy.ansible.com
# ==========================================================================
# Cloud Provider Collections (uncomment as needed)
# ==========================================================================
# AWS Collection
# - name: amazon.aws
# version: ">=6.0.0"
# source: https://galaxy.ansible.com
# - name: community.aws
# version: ">=6.0.0"
# source: https://galaxy.ansible.com
# Azure Collection
# - name: azure.azcollection
# version: ">=1.19.0"
# source: https://galaxy.ansible.com
# Google Cloud Collection
# - name: google.cloud
# version: ">=1.2.0"
# source: https://galaxy.ansible.com
# DigitalOcean Collection
# - name: community.digitalocean
# version: ">=1.24.0"
# source: https://galaxy.ansible.com
# ==========================================================================
# CMDB and Inventory Collections (uncomment as needed)
# ==========================================================================
# NetBox Collection
# - name: netbox.netbox
# version: ">=3.15.0"
# source: https://galaxy.ansible.com
# ServiceNow Collection
# - name: servicenow.servicenow
# version: ">=2.0.0"
# source: https://galaxy.ansible.com
# ==========================================================================
# Monitoring and Observability (uncomment as needed)
# ==========================================================================
# Grafana Collection
# - name: community.grafana
# version: ">=1.6.0"
# source: https://galaxy.ansible.com
# Zabbix Collection
# - name: community.zabbix
# version: ">=2.1.0"
# source: https://galaxy.ansible.com
# Prometheus Collection
# - name: prometheus.prometheus
# version: ">=1.0.0"
# source: https://galaxy.ansible.com
# =============================================================================
# Installation Instructions
# =============================================================================
#
# 1. Install all collections:
# ansible-galaxy collection install -r collections/requirements.yml
#
# 2. Install to specific path:
# ansible-galaxy collection install -r collections/requirements.yml -p ./collections
#
# 3. Force upgrade existing collections:
# ansible-galaxy collection install -r collections/requirements.yml --force
#
# 4. Verify installed collections:
# ansible-galaxy collection list
#
# =============================================================================