From 79a3cb8a143ddbe2ba906ccb85907110836ac9c8 Mon Sep 17 00:00:00 2001 From: Daniel Gonzalez Date: Mon, 10 Oct 2016 16:56:36 +0200 Subject: [PATCH] Add unit test and documentation for playbook_command option --- .../plugins/provisioners/ansible/config/shared.rb | 1 + .../plugins/provisioners/ansible/provisioner_test.rb | 12 ++++++++++++ .../source/docs/provisioning/ansible_common.html.md | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/test/unit/plugins/provisioners/ansible/config/shared.rb b/test/unit/plugins/provisioners/ansible/config/shared.rb index 7ff56ee91..c59a31a94 100644 --- a/test/unit/plugins/provisioners/ansible/config/shared.rb +++ b/test/unit/plugins/provisioners/ansible/config/shared.rb @@ -12,6 +12,7 @@ shared_examples_for 'options shared by both Ansible provisioners' do expect(subject.inventory_path).to be_nil expect(subject.limit).to be_nil expect(subject.playbook).to be_nil + expect(subject.playbook_command).to eql("ansible-playbook") expect(subject.raw_arguments).to be_nil expect(subject.skip_tags).to be_nil expect(subject.start_at_task).to be_nil diff --git a/test/unit/plugins/provisioners/ansible/provisioner_test.rb b/test/unit/plugins/provisioners/ansible/provisioner_test.rb index c26cecf8d..64d58d341 100644 --- a/test/unit/plugins/provisioners/ansible/provisioner_test.rb +++ b/test/unit/plugins/provisioners/ansible/provisioner_test.rb @@ -273,6 +273,18 @@ VF end end + describe "with playbook_command option" do + before do + config.playbook_command = "custom-ansible-playbook" + end + + it "uses custom playbook_command to run playbooks" do + expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args| + expect(args[0]).to eq("custom-ansible-playbook") + } + end + end + describe "with host_vars option" do it_should_create_and_use_generated_inventory diff --git a/website/source/docs/provisioning/ansible_common.html.md b/website/source/docs/provisioning/ansible_common.html.md index 23817b983..81316fa30 100644 --- a/website/source/docs/provisioning/ansible_common.html.md +++ b/website/source/docs/provisioning/ansible_common.html.md @@ -78,6 +78,10 @@ Some of these options are for advanced usage only and should not be used unless By default, this option is disabled and Vagrant generates an inventory based on the `Vagrantfile` information. +- `playbook_command` (string) - The command used to run playbooks. + + The default value is `ansible-playbook` + - `galaxy_command` (template string) - The command pattern used to install Galaxy roles when `galaxy_role_file` is set. The following (optional) placeholders can be used in this command pattern: