plugins/provisioners/ansible/provisioner/host.rb in vagrant-unbundled-1.8.5.2 vs plugins/provisioners/ansible/provisioner/host.rb in vagrant-unbundled-1.9.1.1
- old
+ new
@@ -18,10 +18,11 @@
# At this stage, the SSH access is guaranteed to be ready
@ssh_info = @machine.ssh_info
check_files_existence
warn_for_unsupported_platform
+
execute_ansible_galaxy_from_host if config.galaxy_role_file
execute_ansible_playbook_from_host
end
protected
@@ -86,36 +87,38 @@
raise Ansible::Errors::AnsibleNotFoundOnHost
end
end
def execute_ansible_galaxy_from_host
+ prepare_ansible_config_environment_variable
+
command_values = {
role_file: get_galaxy_role_file,
roles_path: get_galaxy_roles_path
}
command_template = config.galaxy_command.gsub(' ', VAGRANT_ARG_SEPARATOR)
str_command = command_template % command_values
command = str_command.split(VAGRANT_ARG_SEPARATOR)
command << {
+ env: @environment_variables,
# Write stdout and stderr data, since it's the regular Ansible output
notify: [:stdout, :stderr],
workdir: @machine.env.root_path.to_s
}
- # FIXME: role_file and roles_path arguments should be quoted in the console output
- ui_running_ansible_command "galaxy", str_command.gsub(VAGRANT_ARG_SEPARATOR, ' ')
+ ui_running_ansible_command "galaxy", ansible_galaxy_command_for_shell_execution
execute_command_from_host command
end
def execute_ansible_playbook_from_host
- prepare_command_arguments
prepare_environment_variables
+ prepare_command_arguments
# Assemble the full ansible-playbook command
- command = %w(ansible-playbook) << @command_arguments
+ command = [config.playbook_command] << @command_arguments
# Add the raw arguments at the end, to give them the highest precedence
command << config.raw_arguments if config.raw_arguments
command << config.playbook
@@ -231,9 +234,16 @@
proxy_cmd += " -o ForwardAgent=yes" if @ssh_info[:forward_agent]
proxy_cmd += " exec nc %h %p 2>/dev/null"
+ ssh_options << "-o ProxyCommand='#{ proxy_cmd }'"
+ # TODO ssh_options << "-o ProxyCommand=\"#{ proxy_cmd }\""
+ end
+
+ # Use an SSH ProxyCommand when corresponding Vagrant setting is defined
+ if @machine.ssh_info[:proxy_command]
+ proxy_cmd = @machine.ssh_info[:proxy_command]
ssh_options << "-o ProxyCommand='#{ proxy_cmd }'"
end
# Don't access user's known_hosts file, except when host_key_checking is enabled.
ssh_options << "-o UserKnownHostsFile=/dev/null" unless config.host_key_checking