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, 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