This guide will help you get started with the Updates and Patching automation framework.
- Ansible 2.12 or newer
- Python 3.6 or newer
- SSH access to target systems
- Sudo/privilege escalation on targets
# RHEL/CentOS
sudo dnf install ansible
# Ubuntu/Debian
sudo apt install ansible
# From pip
pip3 install ansible ansible-core# Install required collections
ansible-galaxy collection install -r requirements.yml
# Or install individually
ansible-galaxy collection install servicenow.itsm
ansible-galaxy collection install awx.awx
ansible-galaxy collection install ansible.controller
ansible-galaxy collection install nutanix.ncp
ansible-galaxy collection install community.general
ansible-galaxy collection install ansible.posixgit clone https://github.com/ShaddGallegos/updates-and-patching.git
cd updates-and-patching# Create ansible.cfg (if not exists)
make setup
# Or manually
cp env.yml.example env.yml
vi env.yml# Create your inventory from example
cp inventory/example.ini inventory/production
# Edit with your servers
vi inventory/production# Create vault password file
echo "your-vault-password" > ~/.vault_pass.txt
chmod 600 ~/.vault_pass.txt
# Create vault.yml for secrets
ansible-vault create vault.yml --vault-password-file ~/.vault_pass.txtAdd to vault.yml:
---
vault_servicenow_password: "your-servicenow-password"
vault_aap_password: "your-aap-password"
vault_nutanix_password: "your-nutanix-password"
vault_pagerduty_key: "your-pagerduty-key"# Test SSH connectivity
ansible all -i inventory/production -m ping
# Test privilege escalation
ansible all -i inventory/production -m shell -a "whoami" --become# RHEL systems
ansible-playbook playbooks/patching/rhel_patch_manager.yml \
-i inventory/production \
-e "security_only=true"
# All Linux distributions
ansible-playbook playbooks/patching/linux_universal_patcher.yml \
-i inventory/production \
-e "security_only=true"# With dry-run (preview changes)
ansible-playbook playbooks/patching/rhel_patch_manager.yml \
-i inventory/production \
-e "dry_run=true"
# Apply updates
ansible-playbook playbooks/patching/rhel_patch_manager.yml \
-i inventory/production \
-e "allow_reboot=true"# Target single host
ansible-playbook playbooks/patching/rhel_patch_manager.yml \
-i inventory/production \
-l rhel9-web01.example.com
# Target group
ansible-playbook playbooks/patching/rhel_patch_manager.yml \
-i inventory/production \
-l webservers# Scan only
ansible-playbook playbooks/security/vulnerability_scanner.yml \
-i inventory/production
# Scan and remediate
ansible-playbook playbooks/security/vulnerability_scanner.yml \
-i inventory/production \
-e "auto_remediate=true"# All formats (HTML, JSON, YAML, text)
ansible-playbook playbooks/reporting/system_reporter.yml \
-i inventory/production \
-e "report_format=all"
# HTML only with performance metrics
ansible-playbook playbooks/reporting/system_reporter.yml \
-i inventory/production \
-e "report_format=html collect_performance=true collect_security=true"ansible-playbook playbooks/reporting/package_auditor.yml \
-i inventory/production \
-e "audit_type=full"ansible-playbook playbooks/orchestration/automation_wrapper.yml \
-i inventory/production \
-e "workflow=standard"ansible-playbook playbooks/orchestration/automation_wrapper.yml \
-i inventory/production \
-e "workflow=comprehensive email_report=true email_address=admin@example.com"# Patching
make patch-rhel
make patch-universal
# Scanning
make scan-vulns
# Reporting
make report-system
make audit-packages
# Orchestration
make orchestrate
make orchestrate-comprehensive# Install ansible-rulebook
pip3 install ansible-rulebook
# Install EDA collections
ansible-galaxy collection install splunk.eda# Set Splunk credentials
export SPLUNK_HEC_URL="https://splunk.example.com:8088"
export SPLUNK_HEC_TOKEN="your-token-here"
# Configure in env.yml or vault.yml
servicenow_instance: company.service-now.com
aap_host: https://aap.example.comansible-rulebook \
--rulebook playbooks/eda-support/rulebook_disk_monitoring.yml \
--inventory inventory/production \
--verboseThis will:
- Monitor Splunk for disk space alerts
- Automatically extend LVM volumes when usage > 90%
- Create ServiceNow change requests
- Send multi-tier alerts
- Escalate failures to on-call engineers
Always test with dry-run before applying changes:
ansible-playbook <playbook> -i inventory -e "dry_run=true"Preview changes without applying:
ansible-playbook <playbook> -i inventory --checkansible-playbook <playbook> -i inventory --check --diffansible-playbook <playbook> -i inventory -vvvansible-playbook <playbook> -i inventory -l development# Tag servers for maintenance
ansible-playbook playbooks/patching/rhel_patch_manager.yml \
-i inventory/production \
-l production \
-e "security_only=true allow_reboot=true" \
--tags maintenanceFor critical CVEs:
ansible-playbook playbooks/patching/rhel_patch_manager.yml \
-i inventory/production \
-e "security_only=true force_mode=true"# Test connectivity
ansible all -i inventory -m ping -vvv
# Check SSH configuration
ssh -vvv ansible_user@target-host# Test sudo
ansible all -i inventory -m shell -a "whoami" --become -vvv
# Check sudoers configuration on target
sudo visudo# Ansible logs (if configured)
tail -f /var/log/ansible.log
# Playbook execution logs
tail -f /tmp/patch_reports/patch-*.log# Run with maximum verbosity
ANSIBLE_DEBUG=1 ansible-playbook <playbook> -i inventory -vvvv- Always use dry-run first - Preview changes before applying
- Test in development - Test on dev hosts before production
- Use tags - Tag critical systems appropriately
- Schedule appropriately - Run during maintenance windows
- Monitor reports - Review generated reports after execution
- Use vault for secrets - Never commit passwords to git
- Backup before patching - Ensure backups are current
- Check dependencies - Verify application dependencies before updates
- Communicate changes - Notify teams about scheduled patching
- Have rollback plan - Know how to rollback if needed
- Review
playbooks/README.mdfor detailed playbook documentation - Customize variables in
inventory/production - Set up vault credentials in
vault.yml - Test connectivity and permissions
- Run dry-run on development hosts
- Schedule maintenance window
- Execute patching playbooks
- Review reports and logs
- Set up EDA for automated responses
- Documentation:
playbooks/README.md - Examples:
inventory/example.ini - Issues: GitHub Issues
- Questions: Open a discussion