Skip to main content

Overview

Ansible integrates with Xloud through two complementary mechanisms: the openstack.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.cloud collection: ansible-galaxy collection install openstack.cloud
  • Xloud application credentials or openrc file sourced in the shell
  • openstacksdk Python library: pip install openstacksdk

Dynamic Inventory

The openstack.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
Test inventory resolution:
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

Store secrets used in playbooks in Xloud Key Manager (Barbican) or HashiCorp Vault. Retrieve them at runtime using the community.general.hashi_vault or openstack.cloud.identity_user lookup plugins rather than hardcoding in vars files.
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
Remove --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