You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a play that requires I delegate_to localhost at a certain point to download files on the host and copy them to the remote. My logic works in molecule testing, but it always fails during a Packer run. Is there anything specific I need to do to enable localhost delegation?
The text was updated successfully, but these errors were encountered:
First of all I want to preface by stating that my knowledge of Ansible or the plugin is quite limited so apologies in advance if I misunderstand something in there.
When you say that the ansible run fails locally, could you share some information on what fails? Typically including a log generated from a failed build with PACKER_LOG=1 enabled in the environment would be best for us to understand what it is you're trying to do. It would also be best if you could share the template you're using to generate those logs, and other related information like the playbooks you're relying on.
Also from what you're saying here, if the goal is to locally get a file from a distant server, I would think you can do this outside of Ansible if this is a problem, through the shell-local provisioner for example.
Essentially what I'm trying to do is run (via the ansible.builtin.command module) ansible-galaxy collection download on my local machine, because I'm downloading collections from a private GitHub instead of Ansible Galaxy and authentication is required. Then upload the collections to the provisioned target with the copy module, then use the unarchive module on the .tar.gz files. Simple logic and it works in my molecule tests as I said earlier.
What's happening with Packer is when I get to the sections of the playbook that should be delegated to localhost, they're still being ran on the provisioned target. So, the error messages I get are related to the wrong path for the ansible-galaxy binary, since I was hard coding it to my local's path.
One option is separating this part of the playbook out and running it in shell-local but I'd rather avoid that if there is another way.
Hello,
I have a play that requires I delegate_to localhost at a certain point to download files on the host and copy them to the remote. My logic works in molecule testing, but it always fails during a Packer run. Is there anything specific I need to do to enable localhost delegation?
The text was updated successfully, but these errors were encountered: