(this issue is about a missing doc item, not a bug)
in https://github.com/hashicorp/packer/pull/3350 support for ansible-galaxy was introduced into the ansible-local provisioner, there are two new config items implemented in this, only the option "galaxy_file" is documented currently. The 2nd option is "galaxycommand".
Since options are usually underscore separated, it could be considered to change the option to "galaxy_command", otherwise I would just add the doc for the option as it is.
I don't know If I would consider this a docs bug. The reason it looks like it wasn't included in the docs is because its just referencing the name of the ansible-galaxy program, which isn't likely to be different from system to system. Other provisioners choose to hardcode the command name in the default execute statement.
I must not have looked closely enough when I was labeling things, because I agree with you @lfarnell. Can anyone think of a situation when you would want GalaxyCommand to be anything other than "ansible-galaxy"? Otherwise this seems to me like some extra-zealous generalization that doesn't really need documentation.
It can be used to set the proxy env vars (that was the reason why I looked it up), in the same way as described in the "command" key.
I ended up with something like
{
"command":"http_proxy=http://proxy.example.com:8080/ https_proxy=http://proxy.example.com:8080/ ansible-playbook",
"galaxycommand":"http_proxy=http://proxy.example.com:8080/ https_proxy=http://proxy.example.com:8080/ ansible-galaxy"
}
otherwise the build failed due to corporate network restrictions
Ok i didn't see that in the documentation. I will send a PR for this if its something you think would be useful. First, we need to change it from galaxycommand to galaxy_command and update the docs as well.
Thanks for the clarification @alexlehm! I'm thinking it makes sense to do this in two parts; update the docs now for the 1.0.3 release, but save renaming galaxycommand to galaxy_command until the 1.1.0 release, since renaming the command could break people's template.json files and we want to only introduce breaking changes on minor releases.
@lfarnell I think the support for http_proxy is implemented in python's urllib, that's not a specific ansible feature.
I had to put the proxy env into quite a few places to get it working, the ansible command and ansible galaxy settings are useful for that
I think we should consider changing galaxycommand
to galaxy_command
(requires a fixer). And at the same time changing it into a template in the same way as other commands.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Thanks for the clarification @alexlehm! I'm thinking it makes sense to do this in two parts; update the docs now for the 1.0.3 release, but save renaming galaxycommand to galaxy_command until the 1.1.0 release, since renaming the command could break people's template.json files and we want to only introduce breaking changes on minor releases.