Hi all,

I'm a bit of a Packer n00b, so I hope this isn't a silly question. Skip to 
the bottom for the tl;dr, but here's the situation:

I'm using the ansible-local provisioner on an image where ansible was 
installed in the ssh user's account via

pip install --user ansible~=2.9

This places all the ansible executables in ~/.local/bin.

The user's $PATH is modified appropriately in the bash profile, but since 
Packer's ssh communicator doesn't run the remote command in a login shell, 
this has no effect. If I update the command to be

PATH=$PATH:~/.local/bin 
ANSIBLE_REMOTE_TEMP=/opt/packer-provisioner-ansible-local 
PYTHONUNBUFFERED=1 ansible-playbook

it seems to work fine (of course I could just as easily specify the full 
command path).

The problem comes when I try to run ansible-galaxy. I get a command not 
found error, so I attempt a similar fix by setting galaxy_command:

PATH=$PATH:~/.local/bin ansible-galaxy

This is documented here 
<https://www.packer.io/docs/provisioners/ansible-local.html#galaxy_command>, 
but I get the following error:

Errors validating build 'mybuild'. 1 error occurred:
    * unknown configuration key: "galaxy_command"

I am running packer version 1.4.5; it looks like the galaxy parameters were 
added in 1.4.3. The target OS is Amazon Linux 2 (very much RHEL compatible).

1) Why can't I use galaxy_command?

2) Is there a better way of handling the non-standard location for ansible 
binaries?

Thanks!

Ed

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/a2e457a9-c6a2-4fb6-8fab-eddaf895140f%40googlegroups.com.

Reply via email to