Hi folks,
So I ran into this really weird issue today, I was making a new role and for that role I wanted to make some Molecule tests (as we all do, right? )
Previously, I had this as my converge.yml
:
- name: 'Converge'
hosts: 'all'
tasks:
- name: 'Run my role'
ansible.builtin.include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
And up until Molecule 25.3.1
this works just fine™. But now when I run the same code it errors out with:
PLAY [Converge] ****************************************************************
TASK [Gathering Facts] *********************************************************
ok: [dante]
TASK [Run role] ****************************************************************
ERROR! the role 'dante_proxy' was not found in /home/ansible/roles/dante_proxy/molecule/default/roles:/home/ansible/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/ansible/roles/dante_proxy/molecule/default
The workaround? →
---
- name: 'Converge'
hosts: 'all'
tasks:
# lint does not like this....
- name: 'Run role' # noqa role-name[path]
ansible.builtin.include_role:
name: "../../../{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
See below:
PLAY [Converge] ****************************************************************
TASK [Gathering Facts] *********************************************************
ok: [dante]
TASK [Run role] ****************************************************************
TASK [../../../dante_proxy : Ensure packages] **********************************
ok: [dante]
TASK [../../../dante_proxy : Ensure configuration] *****************************
ok: [dante]
TASK [../../../dante_proxy : Ensure service] ***********************************
ok: [dante]
PLAY RECAP *********************************************************************
dante
So I have some questions:
- This hacky workaround is probably not what I should do, what is the correct means of setting the roles path?
- Why did it move in the first place? It was working just fine