Inventories & Target Scopes
Group hosts into logical scopes and environments, manage inventory hierarchy, and inspect live rendered Ansible inventory files.
In Ansible and CIEL, an Inventory defines the target scope of your automation. It answers the fundamental question: which servers should execute this playbook?
Instead of targeting individual IP addresses manually, you group hosts into logical environments (such as Production, Staging, or Edge Nodes) and run playbooks against the entire group with a single click.
1. Creating Inventories & Attaching Hosts
- Navigate to Inventories (
/inventories) in the project sidebar. - Click Create Inventory, enter a unique name (e.g.
Production Infrastructure), identifier slug, and optional description. - Inside the inventory detail view, click + Attach Hosts to link registered servers to this inventory.
- Manage operational host states directly from the table:
- Toggle hosts between Enabled and Disabled within this inventory scope.
- Click the trash icon to detach a host from the inventory without deleting it from the project.
2. Inventory Variables & Computed Scope
In the Group Variables & Sets tab, configure variables that apply to every host attached to this inventory:
- Group Variables: Define shared key-value pairs (e.g.
http_port: 80,app_env: production). - Variable Sets: Attach centrally managed Variable Sets to inject secrets and environment parameters into this inventory.
- Inspect Effective Variables: Click Inspect Vars on any attached host row to view the full computed hierarchy (Host Variables + Inventory Group Variables + Global Project Settings).
3. Ansible YAML Preview
In standard Ansible (see Ansible How to build your inventory), inventories often carry nested all: children: boilerplate. CIEL streamlines the inventory structure directly under your inventory identifier slug.
Inside the YAML Preview & Settings tab, click Render to inspect the real-time executable YAML definition evaluated by the Ansible runner engine:
- Clean Structure: Maps target host IP addresses or endpoints directly with their resolved Ansible connection parameters (
ansible_user,ansible_become,ansible_python_interpreter, and custom host vars). - Copy & Download: Export the compiled
.yamlfile or copy it to your clipboard for verification.
Sample Rendered Output:
production_infrastructure:
hosts:
10.10.10.21:
ansible_become: true
ansible_user: ciel-runner
ansible_python_interpreter: auto_silent
10.10.10.22:
ansible_become: true
ansible_user: ciel-runner
ansible_python_interpreter: auto_silent
10.10.10.31:
ansible_become: true
ansible_user: ciel-runner
ansible_python_interpreter: auto_silent
10.10.10.10:
ansible_user: ciel-runner
ansible_python_interpreter: auto_silent4. Execution Target Scopes (By Inventory vs Direct Hosts)
When launching playbooks, Saved Runs, Schedules, or Webhooks, you define your Target Scope:
- By Inventory: Target an entire inventory group with optional granular filtering:
- All Hosts: Run across every enabled host attached to the inventory.
- Include Selection: Restrict execution to specific subset nodes within the inventory.
- Exclude Selection: Run across all hosts while skipping designated maintenance nodes.
- Direct Hosts: Target one or more individual servers directly without requiring an inventory.
5. External References
For upstream Ansible inventory standards and pattern syntax:
- Ansible Inventory Architecture Guide: Official documentation on building static and dynamic inventories.
- Ansible Group Variables & Inclusions: Scoped variable inheritance patterns across host groups.
- Ansible Host Patterns Reference: Target filtering, exclusion syntax, and pattern sets.