8000 Molecule will not run after editing converge.yml · Issue #4377 · ansible/molecule · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Molecule will not run after editing converge.yml #4377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
7 tasks done
gpettey-ercot opened this issue Jan 22, 2025 · 4 comment 8000 s
Closed
7 tasks done

Molecule will not run after editing converge.yml #4377

gpettey-ercot opened this issue Jan 22, 2025 · 4 comments
Labels

Comments

@gpettey-ercot
Copy link
gpettey-ercot commented Jan 22, 2025

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
@apatard
Copy link
Contributor
apatard commented Jan 23, 2025

it smells like a duplicate of #4372 . I've merged yesterday a fix for that in the plugins repo. I hope to make a new release very soon.

@gpettey-ercot
Copy link
Author
gpettey-ercot commented Jan 23, 2025

it smells like a duplicate of #4372 . I've merged yesterday a fix for that in the plugins repo. I hope to make a new release very soon.

It is not. I applied the changes from ansible-community/molecule-plugins#294 to the podman driver, and I still see same output minus the error and trace about run_command. Evem after updating molecule-plugins to the new release instead of manually fixing it, the same. I updated the snippets in the top post to remove that error output.

@apatard
Copy link
Contributor
apatard commented Jan 24, 2025

@gpettey-ercot oh ok. Now that I'm looking at the new output, it's failing to connect to the test instance and the create.yml playbook doesn't seem to do a lot of things.

  • Which plugin are you using ? [ is your molecule.yml available somewhere ? ]
  • Did you check the create/destroy playbooks ? If you're using a plugin from molecule-plugins, you may have to remove or overwrite the ones in the molecule project directory

@gpettey-ercot
Copy link
Author
gpettey-ercot commented Jan 24, 2025

That those files need to be deleted to use the ones defined in molecule-plugins[podman] should be documented and/or highlighted if it is already documented :) It works now that I know to remove them. I'd also suggest adding an option to molecule init scenario to not generate those two files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants
0