Open isuftin opened 2 years ago
btw, I'm able to get around this issue by specifying the roles and collections path in the builder:
{
"type": "ansible-local",
"playbook_dir": "ansible_playbook",
"playbook_files": ["ansible_playbook/site.yml"],
"galaxy_file": "ansible_playbook/requirements.yml",
"galaxy_roles_path": "/home/ec2-user/.ansible/roles",
"galaxy_collections_path": "/home/ec2-user/.ansible/collections"
}
I did not need to do this in the previous version and this seems like a regression
Assuming the issue was introduced at this point: https://github.com/hashicorp/packer-plugin-ansible/commit/c64d013146eb224bdc38b1e6417d3bf8c58293dc
Hey thanks for this issue, you're not alone with this, I just ran into it as well.
Assuming the issue was introduced at this point: c64d013
That code searches the galaxy_file
for strings that match the regular expressions (?m)^roles:
and (?m)^collections:
. The ansible plugin ought to default to roles if neither regular expression matches. I've rewritten my requirements file in order to work around this bug. There's some information on the current format of the requirements file in the section Installing collections of the Ansible user guide.
Old requirements file:
---
- src: geerlingguy.packer_rhel
- src: geerlingguy.packer-debian
- src: geerlingguy.nfs
New requirements file:
---
roles:
- geerlingguy.packer_rhel
- geerlingguy.packer-debian
- geerlingguy.nfs
Overview of the Issue
The latest Packer 1.8.3 is using the latest release of this plugin. It seems like the latest release of this plugin via ansible-local now installs roles to/galaxy_roles/...
But when running a playbook via ansible-local, that path is not included in the Ansible role paths
Packer 1.8.3 with error:
Packer 1.8.2 working as expected:
Reproduction Steps
Configuration to run ansible-local:
Galaxy file:
site.yml:
Remote system's ansible.cfg:
Remote system is a AWS Marketplace RHEL 8 - ami-08970fb2e5767e3b8 Remote system has Python3.6 and Ansible 4.10.0 installed
Plugin and Packer version
1.8.3
Is no one else getting this?