# Should automation developers be starting with role-only collections?

**URL:** <https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251>\
**Category:** Project Discussions\
**Tags:** role, testing, molecule\
**Created:** [July 15, 2026, 8:31pm UTC](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251 "2026-07-15T20:31:28Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [September 16, 2026, 7:51am UTC](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251/21 "2026-09-16T07:51:49Z")

</div>

> [@kks](#):
>
> What if there are two `reverse1` and `reverse2` scenarions (or more), In what order they will be executed?

I didn’t know the answer to this, so I asked Codex to check the molecule source:

> The relevant flow is:
> 
> - `get_configs()` discovers `molecule.yml` files with `wcmatch.glob()` in `src/molecule/command/base.py:490-529`.
> - `Scenarios.all` then sorts the resulting scenarios with:
> 
> ```auto
> scenarios.sort(key=lambda x: x.directory)
> 
> ```
> 
> So with this layout:
> 
> ```auto
> molecule/reverse1/molecule.yml
> molecule/reverse2/molecule.yml
> 
> ```
> 
> Molecule will process:
> 
> ```auto
> reverse1
> reverse2
> 
> ```
> 
> The existing test `tests/unit/test_scenarios_ordered.py:30-63` confirms this behavior. It supplies configurations in the order `two`, `one`, `three`, but uses directories named `01_foo`, `02_foo`, and `03_foo`. Molecule returns them as `one`, `two`, `three`, based on directory order.

> [@kks](#):
>
> When I execute one scenario will default run automatically? With destroy sequence?

Here is an example with `shared_state: true` and using `uv run tox --ansible -e molecule-py3.12-2.19` - the scenario sequence is that `default -> create` runs first, then all the scenario specific sequences, then finally `default -> destroy`:

> **[community.beszel/extensions/molecule at ansible-native-molecule ·...](https://github.com/dbrennand/community.beszel/tree/ansible-native-molecule/extensions/molecule)**
>
> Ansible content to automate the configuration of Beszel Hub and Agents. - dbrennand/community.beszel

```auto
DETAILS                                                                        
default ➜ create: Executed: Successful

agent_airgap ➜ prepare: Executed: Successful
agent_airgap ➜ converge: Executed: Successful
agent_airgap ➜ cleanup: Executed: Successful

agent_default ➜ prepare: Executed: Successful
agent_default ➜ converge: Executed: Successful
agent_default ➜ cleanup: Executed: Successful

agent_token ➜ prepare: Executed: Successful
agent_token ➜ converge: Executed: Successful
agent_token ➜ cleanup: Executed: Successful

hub_default ➜ converge: Executed: Successful
hub_default ➜ verify: Executed: Successful
hub_default ➜ cleanup: Executed: Successful

default ➜ destroy: Executed: Successful

SCENARIO RECAP                                                                 
default : actions=1 successful=1 disabled=0 skipped=0 missing=0 failed=0
agent_airgap : actions=3 successful=3 disabled=0 skipped=0 missing=0 failed=0
agent_default : actions=3 successful=3 disabled=0 skipped=0 missing=0 failed=0
agent_token : actions=3 successful=3 disabled=0 skipped=0 missing=0 failed=0
hub_default : actions=3 successful=3 disabled=0 skipped=0 missing=0 failed=0
default : actions=1 successful=1 disabled=0 skipped=0 missing=0 failed=0

  molecule-py3.12-2.19: OK (241.33=setup[0.01]+cmd[4.79,73.05,163.48] seconds)
  congratulations :) (241.80 seconds)

```

> [@kks](#):
>
> What if I want to have `reverse1` and `reverse2` scenarions to share state and scenarios `another1` and `another2` share another state? How can I do that?

I don’t think that is possible with `molecule` as is today.

---

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [September 16, 2026, 8:17am UTC](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251/22 "2026-09-16T08:17:36Z")

</div>

Thank you for the answer.

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [November 2, 2026, 11:49am UTC](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251/23 "2026-11-02T11:49:20Z")

</div>

@Jeff_Pullen @kks - The topic of reusable collection playbooks for provisioning molecule instances came up a few weeks ago in the [Ansible DevTools Matrix channel](https://matrix.to/#/!aqMMMrOxRZzVDkUlWF:matrix.org/$E_6tNjEvJ9ofg8MisGFV0PSoFx9fSObC1S8AIXSgVww?via=ansible.com&via=matrix.org&via=ansible.im).

It was related to a PR which came in to `molecule-plugins` to add a brand new driver: [feat(lima): Add Lima driver by simi · Pull Request #387 · ansible-community/molecule-plugins · GitHub](https://github.com/ansible-community/molecule-plugins/pull/387)

My response (if you don’t have access to Matrix):

> Thanks for the driver submission. @ziegenberg and I have recently taken over maintainership of molecule-plugins.
> 
> One thing worth highlighting is that molecule-plugins is a collection of drivers for Molecule’s pre ansible-native operating model. Since Molecule adopted the newer ansible-native model, new platform integrations are generally expected to be implemented as Ansible collections rather than as Molecule drivers.
> 
> The current documentation doesn’t make this distinction particularly clearly, so I understand why you opened this PR.
> 
> My recommendation would be to implement Lima support as an Ansible collection targeting the ansible-native model, rather than adding a new driver to molecule-plugins. That approach aligns with the current direction of the Molecule project and will be a better long term investment. We should also make this guidance much clearer in the molecule-plugins documentation. I’ll open an issue to track updating the documentation so that future contributors are directed towards the ansible-native model for new platform integrations.

The discussion then went toward the option of having a collection playbook for the molecule provisioning:

> The ansible-native pattern favours usage of collections, there shouldn’t be any need to install a Python package like `molecule-lima` (for example).
> 
> With molecule today it is possible to do something like this:
> 
> ```yaml
> # molecule.yml
> ansible:
> playbooks:
> create: create.yml
> destroy: destroy.yml
> 
> ```
> 
> ```yaml
> # create.yml
> - name: Create instances
> ansible.builtin.import_playbook: example.infra.create
> 
> ```
> 
> ```yaml
> # destroy.yml
> - name: Destroy instances
> ansible.builtin.import_playbook: example.infra.destroy
> 
> ```
> 
> Where `example.infra.create` and `example.infra.destroy` are collection playbooks containing all the tasks for handling the create / destroy sequence for the infrastructure provider. The above is like a “wrapper” approach, where you still need the `create.yml` and `destroy.yml` playbooks themselves inside the scenario directory. What I would like to see is support of the below pattern, which you mentioned above:
> 
> ```yaml
> # molecule.yml
> ansible:
> playbooks:
> create: example.infra.create
> destroy: example.infra.destroy
> 
> ```
> 
> This is not supported currently, but if this was there wouldn’t be a need to have a create.yml or destory.yml playbook in the scenario directory at all, molecule could just directly import the collection playbook to handle the create / destroy sequence.

---

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [November 2, 2026, 1:01pm UTC](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251/24 "2026-11-02T13:01:16Z")

</div>

> [@dbrennand](#):
>
> The discussion then went toward the option of having a collection playbook for the molecule provisioning:

so what about this option, is there any chance this will be implemented?

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [November 6, 2026, 8:23am UTC](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251/25 "2026-11-06T08:23:04Z")

</div>

@kks The below is already possible today:

> [@dbrennand](#):
>
> ```yaml
> # molecule.yml
> ansible:
> playbooks:
> create: create.yml
> destroy: destroy.yml
> 
> ```
> 
> ```yaml
> # create.yml
> - name: Create instances
> ansible.builtin.import_playbook: example.infra.create
> 
> ```
> 
> ```yaml
> # destroy.yml
> - name: Destroy instances
> ansible.builtin.import_playbook: example.infra.destroy
> 
> ```

Are you referring to the other below?

> [@dbrennand](#):
>
> ```auto
> # molecule.yml
> ansible:
> playbooks:
> create: example.infra.create
> destroy: example.infra.destroy
> 
> ```

---

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [November 6, 2026, 8:34am UTC](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251/26 "2026-11-06T08:34:41Z")

</div>

I am referring to the latter  
This one:

```yaml
# molecule.yml
ansible:
 playbooks:
   create: example.infra.create
   destroy: example.infra.destroy

```

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [November 6, 2026, 7:51pm UTC](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251/28 "2026-11-06T19:51:32Z")

</div>

> [@kks](#):
>
> I am referring to the latter  
> This one:
> 
> ```yaml
> # molecule.yml
> ansible:
> playbooks:
> create: example.infra.create
> destroy: example.infra.destroy
> 
> ```

[feat: support fully qualified collection name playbook references by dbrennand · Pull Request #4735 · ansible/molecule · GitHub](https://github.com/ansible/molecule/pull/4735) 🙂

---

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [November 6, 2026, 11:10pm UTC](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251/29 "2026-11-06T23:10:51Z")

</div>

> [@dbrennand](#):
>
> [feat: support fully qualified collection name playbook references by dbrennand · Pull Request #4735 · ansible/molecule · GitHub](https://github.com/ansible/molecule/pull/4735) 🙂

That looks great, thank you!

It was possible in molecule (not sure about current version) to use explict playbook in scenario sequence configuration for side\_effect (and only it), e.g.:

```yaml

scenario:
  test_sequence:
    - syntax
    - destroy
    - create
    - prepare
    - converge
    - check
    - idempotence
    - side_effect <<playbook file>>
    - verify
    - cleanup
    - destroy

```

That would be great in side effect also supported FQCN, not only path to playbook file.

[Previous page](https://forum.ansible.com/t/should-automation-developers-be-starting-with-role-only-collections/46251.md?page=1)
