provisioners/ansible: Show Ansible command when VAGRANT_LOG=debug
This commit is contained in:
parent
00e388a897
commit
1c884fa4e5
|
@ -35,6 +35,8 @@ IMPROVEMENTS:
|
|||
- providers/docker: `stop_timeout` can be used to modify the `docker stop`
|
||||
timeout. [GH-4504]
|
||||
- provisioners/chef: Automatically install Chef when using a Chef provisioner.
|
||||
- provisioners/ansible: Always show Ansible command executed when Vagrant log
|
||||
level is debug (even if ansible.verbose is false)
|
||||
- synced\_folders/nfs: Won't use `sudo` to write to /etc/exports if there
|
||||
are write privileges. [GH-2643]
|
||||
- synced\_folders/smb: Credentials from one SMB will be copied to the rest. [GH-4675]
|
||||
|
|
|
@ -66,7 +66,7 @@ module VagrantPlugins
|
|||
# Support Multiple SSH keys and SSH forwarding:
|
||||
env["ANSIBLE_SSH_ARGS"] = ansible_ssh_args unless ansible_ssh_args.empty?
|
||||
|
||||
show_ansible_playbook_command(env, command) if config.verbose
|
||||
show_ansible_playbook_command(env, command) if (config.verbose || @logger.debug?)
|
||||
|
||||
# Write stdout and stderr data, since it's the regular Ansible output
|
||||
command << {
|
||||
|
|
|
@ -50,6 +50,8 @@ VF
|
|||
let(:generated_inventory_file) { File.join(generated_inventory_dir, 'vagrant_ansible_inventory') }
|
||||
|
||||
before do
|
||||
subject.instance_variable_get(:@logger).stub(:debug?).and_return(false)
|
||||
|
||||
machine.stub(ssh_info: ssh_info)
|
||||
machine.env.stub(active_machines: [[iso_env.machine_names[0], :dummy], [iso_env.machine_names[1], :dummy]])
|
||||
|
||||
|
@ -465,6 +467,19 @@ VF
|
|||
end
|
||||
end
|
||||
|
||||
describe "with VAGRANT_LOG=debug, but without verbose option" do
|
||||
before do
|
||||
subject.instance_variable_get(:@logger).stub(:debug?).and_return(true)
|
||||
config.verbose = false
|
||||
end
|
||||
|
||||
it "shows the ansible-playbook command" do
|
||||
expect(machine.env.ui).to receive(:detail).with { |full_command|
|
||||
expect(full_command).to eq("ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false PYTHONUNBUFFERED=1 ansible-playbook --private-key=/path/to/my/key --user=testuser --limit='machine1' --inventory-file=#{generated_inventory_dir} playbook.yml")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
describe "with verbose option" do
|
||||
before do
|
||||
config.verbose = 'v'
|
||||
|
|
Loading…
Reference in New Issue