Skip to content

Molecule will not run after editing converge.yml #4377

Closed
@gpettey-ercot

Description

Prerequisites

  • This was not already reported in the past (duplicate check)
  • It does reproduce it with code from main branch (latest unreleased version)
  • I include a minimal example for reproducing the bug
  • The bug is not trivial, as for those a direct pull-request is preferred
  • Running pip check does not report any conflicts
  • I was able to reproduce the issue on a different machine
  • The issue is not specific to any driver other than 'default' one

Environment

After following basic install/setup in collection/extensions, molecule will not run after I have edited converge.yml to include my role.

-    - name: Replace this task with one that validates your content
-      ansible.builtin.debug:
-        msg: "This is the effective test"
+    - name: include certs role
+      ansible.builtin.include_role:
+        name: certs

What happened

With the default "sample" it will run succesfully:

molecule test output
INFO     default2 scenario test matrix: dependency, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy
INFO     Performing prerun with role_name_check=0...
INFO     Running default2 > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default2 > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default2 > destroy

PLAY [Destroy] *****************************************************************

TASK [Populate instance config] ************************************************
ok: [localhost]

TASK [Dump instance config] ****************************************************
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

INFO     Running default2 > syntax

playbook: /devel/ansible_collections/ercot/general/extensions/molecule/default2/converge.yml
INFO     Running default2 > create

PLAY [Create] ******************************************************************

TASK [Populate instance config dict] *******************************************
skipping: [localhost]

TASK [Convert instance config dict to a list] **********************************
skipping: [localhost]

TASK [Dump instance config] ****************************************************
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=3    rescued=0    ignored=0

INFO     Running default2 > prepare
WARNING  Skipping, prepare playbook not configured.
INFO     Running default2 > converge

PLAY [Converge] ****************************************************************

TASK [Replace this task with one that validates your content] ******************
ok: [instance] => {
    "msg": "This is the effective test"
}

PLAY RECAP *********************************************************************
instance                   : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

INFO     Running default2 > idempotence

PLAY [Converge] ****************************************************************

TASK [Replace this task with one that validates your content] ******************
ok: [instance] => {
    "msg": "This is the effective test"
}

PLAY RECAP *********************************************************************
instance                   : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

INFO     Idempotence completed successfully.
INFO     Running default2 > side_effect
WARNING  Skipping, side effect playbook not configured.
INFO     Running default2 > verify
INFO     Running Ansible Verifier
WARNING  Skipping, verify playbook not configured.
INFO     Verifier completed successfully.
INFO     Running default2 > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default2 > destroy

PLAY [Destroy] *****************************************************************

TASK [Populate instance config] ************************************************
ok: [localhost]

TASK [Dump instance config] ****************************************************
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

INFO     Pruning extra files from scenario ephemeral directory

After making the changes in the diff above, it will fail on an attempt to ssh to the container.

molecule test output
INFO     default scenario test matrix: dependency, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy
INFO     Performing prerun with role_name_check=0...
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy

PLAY [Destroy] *****************************************************************

TASK [Populate instance config] ************************************************
ok: [localhost]

TASK [Dump instance config] ****************************************************
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

INFO     Running default > syntax

playbook: /devel/ansible_collections/ercot/general/extensions/molecule/default/converge.yml
INFO     Running default > create

PLAY [Create] ******************************************************************

TASK [Populate instance config dict] *******************************************
skipping: [localhost]

TASK [Convert instance config dict to a list] **********************************
skipping: [localhost]

TASK [Dump instance config] ****************************************************
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=3    rescued=0    ignored=0

INFO     Running default > prepare
WARNING  Skipping, prepare playbook not configured.
INFO     Running default > converge

PLAY [Converge] ****************************************************************

TASK [include certs role] ******************************************************

TASK [ercot.general.certs : Validating arguments against arg spec 'main' - Installs ERCOT CA certificates to the system trust store, and installs dhparams files.] ***
ok: [instance]

TASK [ercot.general.certs : make paths] ****************************************
failed: [instance] (item=ca_cert_root) => {"ansible_loop_var": "item", "item": "ca_cert_root", "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname instance: Temporary failure in name resolution", "unreachable": true}
failed: [instance] (item=ssl_cert_root) => {"ansible_loop_var": "item", "item": "ssl_cert_root", "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname instance: Temporary failure in name resolution", "unreachable": true}
fatal: [instance]: UNREACHABLE! => {"changed": false, "msg": "All items completed", "results": [{"ansible_loop_var": "item", "item": "ca_cert_root", "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname instance: Temporary failure in name resolution", "unreachable": true}, {"ansible_loop_var": "item", "item": "ssl_cert_root", "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname instance: Temporary failure in name resolution", "unreachable": true}]}

PLAY RECAP *********************************************************************
instance                   : ok=1    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0

CRITICAL Ansible return code was 4, command was: ansible-playbook --inventory /home/gpettey/.cache/molecule/extensions/default/inventory --skip-tags molecule-notest,notest /devel/ansible_collections/ercot/general/extensions/molecule/default/converge.yml
WARNING  An error occurred during the test sequence action: 'converge'. Cleaning up.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy

PLAY [Destroy] *****************************************************************

TASK [Populate instance config] ************************************************
ok: [localhost]

TASK [Dump instance config] ****************************************************
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

INFO     Pruning extra files from scenario ephemeral directory

On the examples page, there are a couple of files suggested to use podman, but says also This example is using Ansible playbooks and it does not need any molecule plugins to run. I have installed molecule-plugins[podman], therefore I should not need that, correct?

Reproducing example

A simple modification to the converge.yaml file produced by `molecule init scenario`, to include ANY role.

---
- name: Converge
  hosts: all
  gather_facts: false
  tasks:
    - name: include certs role
      ansible.builtin.include_role:
        name: certs

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

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions