Skip to content

Add ansible-creator init role to scaffold a standalone role #630

Description

@jeffcpullen
ISSUE TYPE
  • Feature Idea
SUMMARY

ansible-creator init scaffolds collection, playbook, and execution_env, but not role.
The only role path is add resource role, which targets an existing collection, so there is no way
to scaffold a standalone role, the most common artifact a YAML author reaches for after a single
playbook. ansible-galaxy role init leaves them with a bare skeleton: no molecule scenario, no
argument_specs, and metadata that does not pass ansible-lint.

The ask, staged so the MVP stands on its own:

  1. Minimum: init role <name> emitting the standard role skeleton with real, lint-clean
    metadata and a meta/argument_specs.yml starter.
  2. Then: the batteries the other init types already emit, chiefly a native-ansible Molecule
    scenario that converges green out of the box (plus CI, dev-container, lint wiring). creator
    already renders the role templates via add resource role and already emits these batteries for
    init collection, so this is mostly wiring existing pieces to a standalone target.

Happy to help: I can provide working examples of what I think this content should look like.

Scaffolding is even more important to help with testing. Molecule's ansible-native driver switch moved the create/destroy/inventory contract into the author's hands, and the setup process is not intuitive or as easy to implement. Having a common starting point drastically reduces the learning curve. It also standardizes the implementation methods so that additional capabilities and tooling can be built to support role testing like exist for collections.

Prior art / duplicate check (ansible-creator tracker): no existing issue requests a
standalone init role. Closest is #41 (enhanced best-practices scaffolding, done via PR #110);
adjacent open items are #362 (turn off the sample role in a new collection), #338/#251 (molecule
scenarios for existing roles), and #439 (add resource role scope). None cover a standalone role
project.

Reproduction:

  1. ansible-creator init --help -> types are collection, playbook, execution_env; no role.
  2. ansible-creator init role myrole -> not a recognized subcommand.
  3. role appears only under ansible-creator add resource role, scoped to an existing collection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementnewNew issues and PRs to triaged

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions