|
| 1 | +--- |
| 2 | +name: ansible-creator |
| 3 | +description: > |
| 4 | + Reference for scaffolding Ansible content with ansible-creator. |
| 5 | + Use ansible-creator to initialize new collections, playbook projects, |
| 6 | + and execution environments, or to add plugins and resources to existing |
| 7 | + projects. This skill is the canonical lookup table for which subcommand |
| 8 | + and flags to use. |
| 9 | +argument-hint: "[subcommand]" |
| 10 | +user-invocable: true |
| 11 | +metadata: |
| 12 | + author: Ansible DevTools Team |
| 13 | + version: 1.0.0 |
| 14 | +--- |
| 15 | + |
| 16 | +# ansible-creator — Ansible Content Scaffolding Tool |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | +```text |
| 21 | +/ansible-creator # Show full subcommand reference |
| 22 | +/ansible-creator init # How to scaffold new projects |
| 23 | +/ansible-creator add # How to add plugins/resources |
| 24 | +``` |
| 25 | + |
| 26 | +ansible-creator scaffolds Ansible content projects. Use `init` to create new |
| 27 | +projects from scratch and `add` to extend existing ones with plugins or |
| 28 | +resources. |
| 29 | + |
| 30 | +## Hard Rules |
| 31 | + |
| 32 | +1. **Always use `namespace.name` format** for `init collection` and `init playbook`. |
| 33 | +2. **Never scaffold into a non-empty directory** without `-o/--overwrite` — the command will fail. |
| 34 | +3. **After scaffolding, run `tox -e lint`** to verify the generated content passes quality gates. See the `/tox` skill. |
| 35 | +4. **`add plugin` requires the collection root** — the path must point to the directory containing `galaxy.yml`. |
| 36 | + |
| 37 | +## Subcommand Reference |
| 38 | + |
| 39 | +### Initialize projects |
| 40 | + |
| 41 | +| Command | What it creates | Example | |
| 42 | +|---------|----------------|---------| |
| 43 | +| `ansible-creator init collection <ns>.<name> <path>` | Full collection skeleton (plugins, roles, tests, docs, galaxy.yml) | `ansible-creator init collection myorg.network ~/collections/ansible_collections` | |
| 44 | +| `ansible-creator init playbook <ns>.<name> <path>` | Playbook project structure | `ansible-creator init playbook myorg.deploy ~/projects/deploy` | |
| 45 | +| `ansible-creator init execution_env <path>` | Execution environment definition files | `ansible-creator init execution_env ~/ee-project` | |
| 46 | + |
| 47 | +### Add to existing projects |
| 48 | + |
| 49 | +#### Resources |
| 50 | + |
| 51 | +| Command | What it adds | |
| 52 | +|---------|-------------| |
| 53 | +| `ansible-creator add resource devcontainer <path>` | Dev container configuration | |
| 54 | +| `ansible-creator add resource devfile <path>` | Devfile for cloud IDEs | |
| 55 | +| `ansible-creator add resource execution-environment <path>` | Sample EE YAML template | |
| 56 | +| `ansible-creator add resource play-argspec <path>` | Playbook argument specification examples | |
| 57 | +| `ansible-creator add resource role <path>` | New role skeleton | |
| 58 | + |
| 59 | +#### Plugins |
| 60 | + |
| 61 | +| Command | What it adds | Example | |
| 62 | +|---------|-------------|---------| |
| 63 | +| `ansible-creator add plugin action <name> <coll-path>` | Action plugin | `ansible-creator add plugin action my_action .` | |
| 64 | +| `ansible-creator add plugin filter <name> <coll-path>` | Filter plugin | `ansible-creator add plugin filter my_filter .` | |
| 65 | +| `ansible-creator add plugin lookup <name> <coll-path>` | Lookup plugin | `ansible-creator add plugin lookup my_lookup .` | |
| 66 | +| `ansible-creator add plugin module <name> <coll-path>` | Module plugin | `ansible-creator add plugin module my_module .` | |
| 67 | +| `ansible-creator add plugin test <name> <coll-path>` | Test plugin | `ansible-creator add plugin test my_test .` | |
| 68 | + |
| 69 | +## Common Flags |
| 70 | + |
| 71 | +| Flag | Purpose | |
| 72 | +|------|---------| |
| 73 | +| `-o` / `--overwrite` | Overwrite existing files | |
| 74 | +| `-no` / `--no-overwrite` | Fail if destination exists (default) | |
| 75 | +| `--json` | Output in JSON format | |
| 76 | +| `-v` | Increase verbosity (up to `-vvv`) | |
| 77 | +| `--log-file <path>` | Write log to file | |
| 78 | +| `--na` / `--no-ansi` | Disable colored output | |
| 79 | +| `--ll` / `--log-level` | Set logging level (debug, info, warning, error, critical) | |
| 80 | + |
| 81 | +## Common Agent Workflows |
| 82 | + |
| 83 | +### "I need to start a new Ansible collection" |
| 84 | + |
| 85 | +```bash |
| 86 | +ansible-creator init collection myorg.mynetwork ~/collections/ansible_collections |
| 87 | +cd ~/collections/ansible_collections/myorg/mynetwork |
| 88 | +tox -e lint |
| 89 | +``` |
| 90 | + |
| 91 | +### "I need to add a module plugin to an existing collection" |
| 92 | + |
| 93 | +```bash |
| 94 | +cd /path/to/collection # must contain galaxy.yml |
| 95 | +ansible-creator add plugin module my_new_module . |
| 96 | +``` |
| 97 | + |
| 98 | +### "I need to scaffold an execution environment" |
| 99 | + |
| 100 | +```bash |
| 101 | +ansible-creator init execution_env ~/ee-project |
| 102 | +``` |
| 103 | + |
| 104 | +### "The target directory already has files" |
| 105 | + |
| 106 | +Use `--overwrite` to replace existing files, or choose a clean path: |
| 107 | + |
| 108 | +```bash |
| 109 | +ansible-creator init collection myorg.mynetwork ~/collections/ansible_collections --overwrite |
| 110 | +``` |
| 111 | + |
| 112 | +## Installation |
| 113 | + |
| 114 | +```bash |
| 115 | +pip3 install ansible-dev-tools # recommended: includes all devtools |
| 116 | +pip3 install ansible-creator # standalone |
| 117 | +``` |
| 118 | + |
| 119 | +## Configuration |
| 120 | + |
| 121 | +ansible-creator does not use a configuration file. All options are passed as |
| 122 | +CLI flags. Scaffolded projects may include their own `pyproject.toml`, |
| 123 | +`galaxy.yml`, and `tox.ini` for downstream configuration. |
0 commit comments