provisioners/ansible_local: Run galaxy from `provisioning_path` directory
Since it is now possible to specify some Galaxy settings in an `ansible.cfg` file, it makes sense to run `ansible-galaxy` from the same working directory as `ansible-playbook` execution does. See http://docs.ansible.com/ansible/intro_configuration.html#galaxy-settings
This commit is contained in:
parent
df231f2704
commit
cf908d35e0
|
@ -24,7 +24,9 @@ IMPROVEMENTS:
|
||||||
- commands/login: Print a warning with both the environment variable and
|
- commands/login: Print a warning with both the environment variable and
|
||||||
local login token are present [GH-7206, GH-7219]
|
local login token are present [GH-7206, GH-7219]
|
||||||
- communicators/winrm: Upgrade to latest WinRM gems [GH-6922]
|
- communicators/winrm: Upgrade to latest WinRM gems [GH-6922]
|
||||||
- provisioners/ansible(both provisioners): add basic config validators/converters
|
- provisioners/ansible_local: Use `provisioning_path` as working directory
|
||||||
|
for `ansible-galaxy` execution
|
||||||
|
- provisioners/ansible(both provisioners): Add basic config validators/converters
|
||||||
on `raw_arguments` and `raw_ssh_args` options [GH-7103]
|
on `raw_arguments` and `raw_ssh_args` options [GH-7103]
|
||||||
- provisioners/chef: Add the ability to install on SUSE [GH-6806]
|
- provisioners/chef: Add the ability to install on SUSE [GH-6806]
|
||||||
- hosts/darwin: Add `extra_args` support for RDP [GH-5523, GH-6602]
|
- hosts/darwin: Add `extra_args` support for RDP [GH-5523, GH-6602]
|
||||||
|
|
|
@ -69,6 +69,7 @@ module VagrantPlugins
|
||||||
:role_file => get_galaxy_role_file(config.provisioning_path),
|
:role_file => get_galaxy_role_file(config.provisioning_path),
|
||||||
:roles_path => get_galaxy_roles_path(config.provisioning_path)
|
:roles_path => get_galaxy_roles_path(config.provisioning_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
remote_command = config.galaxy_command % command_values
|
remote_command = config.galaxy_command % command_values
|
||||||
|
|
||||||
execute_ansible_command_on_guest "galaxy", remote_command
|
execute_ansible_command_on_guest "galaxy", remote_command
|
||||||
|
@ -78,15 +79,15 @@ module VagrantPlugins
|
||||||
prepare_common_command_arguments
|
prepare_common_command_arguments
|
||||||
prepare_common_environment_variables
|
prepare_common_environment_variables
|
||||||
|
|
||||||
remote_command = "cd #{config.provisioning_path} && #{ansible_playbook_command_for_shell_execution}"
|
execute_ansible_command_on_guest "playbook", ansible_playbook_command_for_shell_execution
|
||||||
|
|
||||||
execute_ansible_command_on_guest "playbook", remote_command
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute_ansible_command_on_guest(name, command)
|
def execute_ansible_command_on_guest(name, command)
|
||||||
ui_running_ansible_command name, command
|
remote_command = "cd #{config.provisioning_path} && #{command}"
|
||||||
|
|
||||||
result = execute_on_guest(command)
|
ui_running_ansible_command name, remote_command
|
||||||
|
|
||||||
|
result = execute_on_guest(remote_command)
|
||||||
raise Ansible::Errors::AnsibleCommandFailed if result != 0
|
raise Ansible::Errors::AnsibleCommandFailed if result != 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ This section lists the specific options for the Ansible Local provisioner. In ad
|
||||||
|
|
||||||
**Attention:** There is no guarantee that this automated installation will replace a custom Ansible setup, that might be already present on the Vagrant box.
|
**Attention:** There is no guarantee that this automated installation will replace a custom Ansible setup, that might be already present on the Vagrant box.
|
||||||
|
|
||||||
- `provisioning_path` (string) - An absolute path on the guest machine where the Ansible files are stored. The `ansible-playbook` command is executed from this directory.
|
- `provisioning_path` (string) - An absolute path on the guest machine where the Ansible files are stored. The `ansible-galaxy` and `ansible-playbook` commands are executed from this directory. This is the location to place an [ansible.cfg](http://docs.ansible.com/ansible/intro_configuration.html) file, in case you need it.
|
||||||
|
|
||||||
The default value is `/vagrant`.
|
The default value is `/vagrant`.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue