AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

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-creator

Verify installation:

ansible-creator --version
ansible-creator --help

Scaffold a New Collection

ansible-creator init collection myorg.mytools \
  --init-path ./collections

This 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 ./projects

Generated structure:

projects/my_project/
├── ansible.cfg
├── inventory/
│   ├── hosts.yml
│   └── group_vars/
├── playbooks/
│   └── site.yml
├── roles/
│   └── requirements.yml
├── collections/
│   └── requirements.yml
├── files/
├── templates/
└── README.md

Add 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.yaml

VS Code Integration

ansible-creator integrates with the Ansible VS Code Extension:

  1. Install the Ansible extension in VS Code
  2. Open Command Palette (Ctrl+Shift+P)
  3. Search for "Ansible: Create"
  4. Select project type (collection, playbook, role)
  5. 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.gz

Command Line Completion

pip install argcomplete --user
activate-global-python-argcomplete --user

# Now tab-complete works
ansible-creator <TAB>

ansible-creator vs ansible-galaxy init

Featureansible-creatoransible-galaxy init
Collections✅ Full structure✅ Basic
Playbook projects
Add resources✅ (add command)
VS Code integration
Best practices✅ Built-in⚠️ Minimal
Test scaffolding
MaintainedActiveLegacy

Best Practices

  • Use ansible-creator for new projects — it follows current best practices and creates all necessary files
  • Pin your collection dependencies in requirements.yml with version constraints
  • Include tests from the start — the scaffolded test directories remind you to write tests
  • Use meta/runtime.yml for module routing and deprecation management
  • Keep changelogs/ updated with antsibull-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.

What's New in v26.4.0 (April 2026)

The latest release (v26.4.0) includes:

  • Fix: ansible-galaxy collection list now 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.0

Use the Dev Container

podman run -it ghcr.io/ansible/community-ansible-dev-tools:latest

Version History

VersionDateKey Changes
v26.4.0Apr 2, 2026Graceful EE test step, dependency bumps
v26.3.3Mar 31, 2026Bug fixes, dependency updates
v26.3.0Mar 5, 2026New scaffolding features
v26.2.0Feb 25, 2026Initial v26 release

Category: installation

Browse all Ansible tutorials · AnsiblePilot Home