Skip to content
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

Error when attempting to test collection playbooks using FQCN #4244

Open
7 tasks done
FragmentedPacket opened this issue Jun 27, 2024 · 0 comments
Open
7 tasks done

Comments

@FragmentedPacket
Copy link

FragmentedPacket commented Jun 27, 2024

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

molecule 24.6.1.dev39 using python 3.10
ansible:2.17.1
default:24.6.1.dev39 from molecule

What happened

I have the following converge.yml that is being called to test a playbook that exists in a collection.

---
- ansible.builtin.import_playbook: yo.test.test_playbook

I get the following error when running molecule test --all

❯ molecule test --all
INFO     Performing prerun with role_name_check=0...
INFO     Running test_playbook > converge
ERROR! Unable to retrieve file contents
Could not find or access '/Users/myohman/local-dev/molecule-test/yo/molecule/test_playbook/yo.test.test_playbook' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
CRITICAL Ansible return code was 1, command was: ansible-playbook --inventory /Users/myohman/.cache/molecule/yo/test_playbook/inventory --skip-tags molecule-notest,notest /Users/myohman/local-dev/molecule-test/yo/molecule/test_playbook/converge.yml
WARNING  An error occurred during the test sequence action: 'converge'. Cleaning up.
INFO     Running test_playbook > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running test_playbook > 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

My expectation is it would load a playbook from a collection.

Reproducing example

(I tested with multiple versions of Ansible Core and Molecule, you should be able to use the latest of both and reproduce)

  1. ansible-galaxy collection init yo.test
  2. cd yo
  3. molecule init scenario test_playbook
  4. mkdir playbooks && touch test_playbook.yml
  5. Add the follow play to test_playbook.yml
---
- hosts: localhost
  tasks:
    - name: Test task
      debug:
        msg: "Hello, world!"
  1. Update molecule/test_playbook/converge.yml
---
- ansible.builtin.import_playbook: yo.test.test_playbook
  1. Add scenario and only the converge test molecule/test_playbook/molecule.yml
---
scenario:
  test_sequence:
    - converge
driver:
  name: default
platforms:
  - name: instance
  1. Run molecule init scenario test_playbook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants