diff --git a/CHANGELOG.md b/CHANGELOG.md index a8f854210..a16d67b79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,6 +99,7 @@ BUG FIXES: - provisioners/ansible: fix SSH settings to support more than 5 ssh keys [GH-5017] - provisioners/ansible: increase ansible connection timeout to 30 seconds [GH-5018] - provisioners/ansible: disable color if Vagrant is not colored [GH-5531, GH-5532] + - provisioners/ansible: only show ansible-playbook command when `verbose` option is enabled [GH-5803] - provisioners/docker: use `service` to restart Docker instad of upstart [GH-5245, GH-5577] - provisioners/docker: Only add docker user to group if exists. [GH-5315] - provisioners/docker: Use https for repo [GH-5749] diff --git a/plugins/provisioners/ansible/provisioner.rb b/plugins/provisioners/ansible/provisioner.rb index 15e915d19..1aa7d57a1 100644 --- a/plugins/provisioners/ansible/provisioner.rb +++ b/plugins/provisioners/ansible/provisioner.rb @@ -81,7 +81,7 @@ module VagrantPlugins # ANSIBLE_SSH_ARGS is required for Multiple SSH keys, SSH forwarding and custom SSH settings env["ANSIBLE_SSH_ARGS"] = ansible_ssh_args unless ansible_ssh_args.empty? - show_ansible_playbook_command(env, command) if (config.verbose || @logger.debug?) + show_ansible_playbook_command(env, command) if config.verbose # Write stdout and stderr data, since it's the regular Ansible output command << { diff --git a/test/unit/plugins/provisioners/ansible/provisioner_test.rb b/test/unit/plugins/provisioners/ansible/provisioner_test.rb index ca9a891c8..5600a1753 100644 --- a/test/unit/plugins/provisioners/ansible/provisioner_test.rb +++ b/test/unit/plugins/provisioners/ansible/provisioner_test.rb @@ -51,7 +51,6 @@ VF before do Vagrant::Util::Platform.stub(solaris?: false) - 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,19 +464,6 @@ 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("PYTHONUNBUFFERED=1 ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_FORCE_COLOR=true ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --private-key=/path/to/my/key --user=testuser --connection=ssh --timeout=30 --limit='machine1' --inventory-file=#{generated_inventory_dir} playbook.yml") - } - end - end - describe "with verbose option" do before do config.verbose = 'v'