From atmos
Orchestrates Ansible playbooks via Atmos CLI: resolves stack manifests, generates vars/inventory files, sets env vars, executes playbooks for stack components.
npx claudepluginhub cloudposse/atmos --plugin atmosThis skill uses the workspace's default tool permissions.
Atmos wraps the Ansible CLI to provide stack-aware orchestration of configuration management operations. Instead of
Automates infrastructure provisioning, configuration management, and app deployment using Ansible playbooks, roles, and inventory. Use for server patching, multi-server orchestration, and cloud provisioning.
Guides writing Ansible playbooks, roles, inventories, and module usage for IT automation, configuration management, and infrastructure tasks.
Provides examples and best practices for writing Ansible playbooks to automate configuration management, server setup, and infrastructure orchestration.
Share bugs, ideas, or general feedback.
Atmos wraps the Ansible CLI to provide stack-aware orchestration of configuration management operations. Instead of manually managing variables, inventory, and playbook paths for each Ansible component, Atmos resolves the full configuration from stack manifests and handles all of these concerns automatically.
Note:
atmos ansible playbookis designed for interactive operator sessions where a human is present to monitor output, respond to prompts, and approve changes. It is not suitable for headless CI/CD automation where no interactive terminal is available. For automated pipelines, use a dedicated Ansible CI runner or invokeansible-playbookdirectly from a CI step with pre-exported credentials.
When you run atmos ansible playbook, Atmos performs the following sequence:
vars defined for the component in the
stack, following the naming convention <context>-<component>.ansible.vars.yaml.--playbook flag or
settings.ansible.playbook in the stack manifest.--inventory flag or
settings.ansible.inventory in the stack manifest.env settings from the stack manifest.ansible-playbook -- Runs the playbook in the component directory, passing the generated
variables file via --extra-vars @<varfile> and any additional native flags.This means a single command like atmos ansible playbook webserver -s prod replaces what would normally require
finding the right playbook, constructing extra-vars, specifying inventory, and managing environment variables
manually.
Run an Ansible playbook for a component in a stack.
atmos ansible playbook <component> -s <stack> [flags] [-- ansible-options]
# Basic playbook execution
atmos ansible playbook webserver -s prod
# Specify playbook explicitly (overrides stack manifest)
atmos ansible playbook webserver -s prod --playbook deploy.yml
# Specify both playbook and inventory
atmos ansible playbook webserver -s prod -p site.yml -i inventory/production
# Dry run (shows command without executing)
atmos ansible playbook webserver -s prod --dry-run
# Pass native ansible-playbook flags after --
atmos ansible playbook webserver -s prod -- --check
atmos ansible playbook webserver -s prod -- -vvv
atmos ansible playbook webserver -s prod -- --limit "web01,web02"
atmos ansible playbook webserver -s prod -- --tags "deploy,config"
atmos ansible playbook webserver -s prod -- --skip-tags "slow"
atmos ansible playbook webserver -s prod -- --extra-vars "version=1.2.3"
Display the installed Ansible version and configuration information.
atmos ansible version
This runs ansible --version and shows the Ansible version, configuration file location, module search path,
Python version, and other details.
Ansible components live under components.ansible in stack manifests:
components:
ansible:
<component_name>:
vars: {} # Variables passed via --extra-vars
env: {} # Environment variables during execution
settings:
ansible:
playbook: <file> # Playbook file to run
inventory: <src> # Inventory source (file, directory, or script)
metadata: {} # Component behavior and inheritance
command: ansible # Override ansible binary
hooks: {} # Lifecycle event handlers
components:
ansible:
hello-world:
vars:
app_name: my-app
app_version: "1.0.0"
app_port: 8080
settings:
ansible:
playbook: site.yml
inventory: inventory.ini
import:
- catalog/ansible/_defaults
- orgs/acme/plat/prod/_defaults
vars:
region: us-east-1
stage: prod
ansible:
vars:
managed_by: Atmos
env:
# Security note: Setting ANSIBLE_HOST_KEY_CHECKING to "false" disables SSH host key verification,
# which exposes connections to man-in-the-middle attacks. Only use this in controlled environments
# (e.g., ephemeral CI environments with known-clean network paths). For production environments,
# maintain and distribute a known_hosts file or use the ansible_ssh_extra_args approach with
# StrictHostKeyChecking=accept-new to accept keys on first connection only.
ANSIBLE_HOST_KEY_CHECKING: "false"
components:
ansible:
webserver:
vars:
app_name: myapp
app_port: 8080
app_version: "2.0.0"
settings:
ansible:
playbook: site.yml
inventory: inventory/production
database:
metadata:
component: database
vars:
db_name: acme-prod
db_port: 5432
settings:
ansible:
playbook: deploy.yml
inventory: inventory/production
depends_on:
- component: webserver
Define defaults that apply to all Ansible components in a stack:
# These apply to all Ansible components
ansible:
vars:
managed_by: Atmos
env:
# Security note: ANSIBLE_HOST_KEY_CHECKING: "false" disables SSH host key verification and should
# only be used in controlled environments. For production, use a known_hosts file instead.
ANSIBLE_HOST_KEY_CHECKING: "false"
ANSIBLE_FORCE_COLOR: "true"
# Individual components inherit and can override
components:
ansible:
webserver:
vars:
app_port: 8080
Atmos generates a YAML file from the vars section and passes it to ansible-playbook using
--extra-vars @<filename>. All stack variables become available directly in playbooks.
The generated file follows the naming convention: <context>-<component>.ansible.vars.yaml
For example, for component webserver with context prefix acme-plat-prod-us-east-1, the file is:
acme-plat-prod-us-east-1-webserver.ansible.vars.yaml
# Stack manifest
components:
ansible:
webserver:
vars:
app_name: myapp
app_port: 8080
# Playbook references variables directly
- name: Deploy app
hosts: webservers
tasks:
- name: Show config
ansible.builtin.debug:
msg: "Deploying {{ app_name }} on port {{ app_port }}"
The playbook and inventory can be specified in two ways. Command-line flags always take precedence over stack manifest settings.
Resolution order (highest to lowest priority):
--playbook / -p and --inventory / -isettings.ansible.playbook and settings.ansible.inventory# Stack manifest (lower priority)
components:
ansible:
webserver:
settings:
ansible:
playbook: site.yml
inventory: inventory/production
# Command-line override (higher priority)
atmos ansible playbook webserver -s prod --playbook deploy.yml -i inventory/staging
Configure Ansible behavior in atmos.yaml:
components:
ansible:
# Executable to run
command: ansible
# Base path to Ansible components
base_path: components/ansible
command -- Executable to run for Ansible commands. Defaults to ansible. Supports absolute paths
(e.g., /usr/local/bin/ansible or /opt/venv/bin/ansible).base_path -- Directory containing Ansible component directories. Each subdirectory should contain
playbooks and related files (roles, inventory, etc.).components/ansible/
hello-world/
site.yml
inventory.ini
webserver/
site.yml
roles/
nginx/
inventory/
production
staging
database/
deploy.yml
inventory.ini
Use filesystem paths instead of component names for convenience:
# Navigate to component directory and use current directory
cd components/ansible/webserver
atmos ansible playbook . -s prod
# Relative path from components/ansible
cd components/ansible
atmos ansible playbook ./webserver -s prod
# From project root with relative path
atmos ansible playbook components/ansible/webserver -s prod
# Combine with other flags
cd components/ansible/webserver
atmos ansible playbook . -s prod --playbook deploy.yml --inventory production
Supported path formats:
. -- Current directory./component -- Relative path from current directory../other-component -- Relative path to sibling directory/absolute/path/to/component -- Absolute pathRequirements:
--stack flag.Common environment variables for Ansible components configured via env:
ANSIBLE_HOST_KEY_CHECKING -- Controls SSH host key verification. Prefer "true" in production; only set to "false" in ephemeral or development environments with explicit risk acceptance.ANSIBLE_FORCE_COLOR -- Force colored output (set to true).ANSIBLE_CONFIG -- Path to Ansible configuration file.ANSIBLE_VAULT_PASSWORD_FILE -- Path to Ansible Vault password file.ANSIBLE_ROLES_PATH -- Additional paths to search for roles.ANSIBLE_COLLECTIONS_PATH -- Paths to search for collections.components:
ansible:
webserver:
env:
# Only disable host key checking in dev/ephemeral environments (see security note above)
ANSIBLE_HOST_KEY_CHECKING: "false"
ANSIBLE_FORCE_COLOR: "true"
ANSIBLE_VAULT_PASSWORD_FILE: /path/to/vault-password
Any flags placed after -- are passed directly to ansible-playbook:
# Check mode (dry run at Ansible level)
atmos ansible playbook webserver -s prod -- --check
# Verbose output
atmos ansible playbook webserver -s prod -- -vvv
# Limit to specific hosts
atmos ansible playbook webserver -s prod -- --limit "web01,web02"
# Run specific tags
atmos ansible playbook webserver -s prod -- --tags "deploy"
# Skip specific tags
atmos ansible playbook webserver -s prod -- --skip-tags "slow"
# Additional extra variables (on top of those generated by Atmos)
atmos ansible playbook webserver -s prod -- --extra-vars "version=1.2.3"
# Combine multiple native flags
atmos ansible playbook webserver -s prod -- --check --diff --limit web01 -vv
Ansible components support the same inheritance model as other Atmos component types:
# stacks/catalog/hello-world.yaml (shared defaults)
components:
ansible:
hello-world:
vars:
app_name: my-app
app_version: "1.0.0"
app_port: 8080
settings:
ansible:
playbook: site.yml
inventory: inventory.ini
# stacks/deploy/dev.yaml (environment override)
import:
- catalog/hello-world
vars:
stage: dev
components:
ansible:
hello-world:
vars:
app_version: "1.0.0-dev"
# stacks/deploy/prod.yaml (environment override)
import:
- catalog/hello-world
vars:
stage: prod
components:
ansible:
hello-world:
vars:
app_version: "2.0.0"
app_port: 443
Use atmos describe component to see the fully resolved configuration:
atmos describe component hello-world -s dev --type ansible
Preview what Atmos will do without executing:
atmos ansible playbook webserver -s prod --dry-run
Interactive use only:
atmos ansible playbookis intended for interactive operator sessions, not headless CI/CD automation. Ensure a human is present to monitor output and respond to any interactive prompts. For fully automated pipelines, invokeansible-playbookdirectly from a CI step.
Use stack manifest settings for playbook configuration. Define settings.ansible.playbook and
settings.ansible.inventory rather than passing flags every time.
Centralize defaults in catalog files. Define common settings in catalog defaults and override only what differs per environment.
Use depends_on for ordering. Define dependencies when playbooks need to run after infrastructure
is provisioned (e.g., after Terraform components).
Keep playbooks focused. Create small, task-specific playbooks rather than monolithic automation.
Use env for Ansible configuration. Configure Ansible behavior through environment variables
rather than ansible.cfg for consistency across environments.
Leverage inheritance. Use abstract components and inheritance for shared playbook configurations across environments.
Use --dry-run before production runs. Preview the commands Atmos will execute before running
against production infrastructure.