Overview
Ansible integrates with Xloud through two complementary mechanisms: theopenstack.cloud
collection for infrastructure automation, and SSH/WinRM-based playbooks for instance
configuration. Ansible operates agentlessly — no software is installed on your managed instances
beyond a working SSH daemon and Python interpreter.
The Xloud dynamic inventory plugin sources instance metadata directly from the compute API,
automatically organizing hosts by project, availability zone, image, and custom metadata tags.
Prerequisites
- Ansible 2.12 or later installed
openstack.cloudcollection:ansible-galaxy collection install openstack.cloud- Xloud application credentials or
openrcfile sourced in the shell openstacksdkPython library:pip install openstacksdk
Dynamic Inventory
Theopenstack.cloud.openstack inventory plugin generates a live host list from the Xloud
compute API. Hosts are grouped by instance metadata, eliminating the need to maintain static
inventory files.
inventory/openstack.yml
List dynamic inventory hosts
Playbook Examples
OS Bootstrap
Bootstrap a newly provisioned instance with required packages, users, and firewall rules:playbooks/bootstrap.yml
Patch Management
Apply security patches across all instances in a project:playbooks/patch.yml
CIS Compliance Enforcement
Apply CIS baseline hardening to Linux instances:playbooks/cis-harden.yml
Infrastructure Management via Xloud Modules
Create and manage Xloud resources directly from playbooks:playbooks/provision.yml
Credential Management
group_vars/all/vault.yml
Run playbook with vault password
Running Playbooks
Source credentials
Load Xloud credentials
Test connectivity
Ping all dynamic inventory hosts
All targeted instances return a
pong response.Run a playbook
Run bootstrap playbook
--check to apply changes. --diff shows what would change on each host.Verify results
Check instance facts
Playbook completes with no failed tasks. Verify changes on instances via SSH or the Dashboard console.
Next Steps
Terraform Integration
Use Terraform for provisioning and Ansible for post-provision configuration
Wazuh Integration
Deploy Wazuh agents using Ansible playbooks for SIEM and compliance monitoring
Key Manager
Store playbook secrets in Xloud Key Manager for secure credential retrieval
Auto-Scaling
Bootstrap auto-scaled instances using Ansible cloud-init integration