Ansible Creator CLI: Scaffold Collections, Roles & Projects (v26.4.0)
By Luca Berton · Published 2024-01-01 · Category: installation
Complete guide to ansible-creator CLI v26.4.0. Scaffold Ansible collections, roles, and projects.
Introduction
ansible-creator is the official CLI tool for scaffolding Ansible content. Instead of manually creating directory structures for collections, roles, and playbook projects, ansible-creator generates everything with proper structure, metadata, and best practices built in.
Released as v26.3.3, it's maintained by the Ansible team and integrates directly with the VS Code Ansible Extension.
See also: Ansible Dev Tools v26.4.0: Complete Development Toolkit Guide
Install ansible-creator
pip install ansible-creatorVerify installation:
ansible-creator --version
ansible-creator --helpScaffold a New Collection
ansible-creator init collection myorg.mytools \
--init-path ./collectionsThis creates:
collections/myorg/mytools/
├── galaxy.yml
├── README.md
├── plugins/
│ ├── modules/
│ ├── filter/
│ ├── lookup/
│ └── module_utils/
├── roles/
├── playbooks/
├── docs/
├── tests/
│ ├── integration/
│ └── unit/
├── meta/
│ └── runtime.yml
└── changelogs/See also: Ansible Galaxy: Install, Create & Share Roles and Collections (Guide)
Scaffold a New Playbook Project
ansible-creator init playbook my_project \
--init-path ./projectsGenerated structure:
projects/my_project/
├── ansible.cfg
├── inventory/
│ ├── hosts.yml
│ └── group_vars/
├── playbooks/
│ └── site.yml
├── roles/
│ └── requirements.yml
├── collections/
│ └── requirements.yml
├── files/
├── templates/
└── README.mdAdd Resources to Existing Projects
# Add a new role
ansible-creator add role webserver \
--path ./collections/myorg/mytools/
# Add a new module plugin
ansible-creator add plugin module my_module \
--path ./collections/myorg/mytools/See also: Ansible Galaxy: Install Collections & Roles — Complete Guide (2026)
Collection galaxy.yml
The generated galaxy.yml includes all required metadata:
namespace: myorg
name: mytools
version: 1.0.0
readme: README.md
authors:
- Your Name <your@email.com>
description: My custom Ansible collection
license:
- GPL-2.0-or-later
repository: https://github.com/myorg/ansible-collection-mytools
documentation: https://github.com/myorg/ansible-collection-mytools/blob/main/README.md
issues: https://github.com/myorg/ansible-collection-mytools/issues
build_ignore:
- .gitignore
- changelogs/.plugin-cache.yamlVS Code Integration
ansible-creator integrates with the Ansible VS Code Extension:
- Install the Ansible extension in VS Code
- Open Command Palette (
Ctrl+Shift+P) - Search for "Ansible: Create"
- Select project type (collection, playbook, role)
- VS Code runs ansible-creator in the background
Development Workflow
# 1. Scaffold collection
ansible-creator init collection myorg.infra
# 2. Add modules
ansible-creator add plugin module configure_app \
--path ./myorg/infra/
# 3. Add roles
ansible-creator add role webserver \
--path ./myorg/infra/
# 4. Develop and test
cd myorg/infra
ansible-test sanity --docker
molecule test
# 5. Build and publish
ansible-galaxy collection build
ansible-galaxy collection publish myorg-infra-1.0.0.tar.gzCommand Line Completion
pip install argcomplete --user
activate-global-python-argcomplete --user
# Now tab-complete works
ansible-creator <TAB>ansible-creator vs ansible-galaxy init
| Feature | ansible-creator | ansible-galaxy init |
|---|---|---|
| Collections | ✅ Full structure | ✅ Basic |
| Playbook projects | ✅ | ❌ |
| Add resources | ✅ (add command) | ❌ |
| VS Code integration | ✅ | ❌ |
| Best practices | ✅ Built-in | ⚠️ Minimal |
| Test scaffolding | ✅ | ❌ |
| Maintained | Active | Legacy |
Best Practices
- Use ansible-creator for new projects — it follows current best practices and creates all necessary files
- Pin your collection dependencies in
requirements.ymlwith version constraints - Include tests from the start — the scaffolded test directories remind you to write tests
- Use
meta/runtime.ymlfor module routing and deprecation management - Keep
changelogs/updated withantsibull-changelog
FAQ
Do I need ansible-creator to create collections?
No — you can create the directory structure manually or use ansible-galaxy collection init. But ansible-creator provides a more complete scaffold with testing infrastructure and documentation templates.
Can I customize the scaffolding templates?
Not yet in the current version. The templates follow Ansible community best practices. Custom templates may be supported in future releases.
Does ansible-creator work with Execution Environments?
ansible-creator scaffolds content that works inside EEs. For building EEs themselves, use ansible-builder.
What Python version is required?
ansible-creator requires Python 3.10 or newer.
Related Articles
- Ansible Dev Tools v26.4.0: Complete Development Toolkit Guide
- Ansible Galaxy: Install, Create & Share Roles and Collections (Guide)
- Ansible Galaxy: Install Collections & Roles — Complete Guide (2026)
What's New in v26.4.0 (April 2026)
The latest release (v26.4.0) includes:
- Fix:
ansible-galaxy collection listnow fails gracefully in EE test steps — previously, scaffolded Execution Environment tests could fail when the collection wasn't installed yet - Dependency updates: cryptography 46.0.6, requests 2.33.0, pygments 2.20.0
Install the Latest Version
# Single tool
pip install -U ansible-creator
# All dev tools (recommended)
pip install -U ansible-dev-tools
# Verify version
ansible-creator --version
# ansible-creator 26.4.0Use the Dev Container
podman run -it ghcr.io/ansible/community-ansible-dev-tools:latestVersion History
| Version | Date | Key Changes |
|---|---|---|
| v26.4.0 | Apr 2, 2026 | Graceful EE test step, dependency bumps |
| v26.3.3 | Mar 31, 2026 | Bug fixes, dependency updates |
| v26.3.0 | Mar 5, 2026 | New scaffolding features |
| v26.2.0 | Feb 25, 2026 | Initial v26 release |
Category: installation