provisoners/ansible(both): Accept 'all:vars'
The patterns "all" is a special keyword that target all hosts in the inventory. Therefore it makes sense to accept "all:vars" as a group variable name. Note that "*:vars" pattern is not valid in an Ansible inventory. See http://docs.ansible.com/ansible/latest/intro_patterns.html#patterns Fix #7730
This commit is contained in:
parent
2170d40bb2
commit
b741ff7999
|
@ -12,6 +12,7 @@ IMPROVEMENTS:
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
- guests/shell_expand_guest_path : Properly expand guest paths that include relative path alias [GH-8918]
|
- guests/shell_expand_guest_path : Properly expand guest paths that include relative path alias [GH-8918]
|
||||||
|
- provisioners/ansible(both): Add the "all:vars" section to the inventory when defined in `groups` option [GH-7730]
|
||||||
- util/ssh: Properly quote key path for IdentityFile option to allow for spaces [GH-8924]
|
- util/ssh: Properly quote key path for IdentityFile option to allow for spaces [GH-8924]
|
||||||
|
|
||||||
## 1.9.8 (August 23, 2017)
|
## 1.9.8 (August 23, 2017)
|
||||||
|
|
|
@ -228,7 +228,7 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
group_vars.each_pair do |gname, gmembers|
|
group_vars.each_pair do |gname, gmembers|
|
||||||
if defined_groups.include?(gname.sub(/:vars$/, ""))
|
if defined_groups.include?(gname.sub(/:vars$/, "")) || gname == "all:vars"
|
||||||
inventory_groups += "\n[#{gname}]\n" + gmembers.join("\n") + "\n"
|
inventory_groups += "\n[#{gname}]\n" + gmembers.join("\n") + "\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -396,6 +396,19 @@ VF
|
||||||
expect(inventory_content).to include("[group3:vars]\nstringvar1=stringvalue1\nstringvar2=stringvalue2\n")
|
expect(inventory_content).to include("[group3:vars]\nstringvar1=stringvalue1\nstringvar2=stringvalue2\n")
|
||||||
}.and_return(default_execute_result)
|
}.and_return(default_execute_result)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "adds 'all:vars' section to the generated inventory" do
|
||||||
|
config.groups = {
|
||||||
|
"all:vars" => { "var1" => "value1", "var2" => "value2" }
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(Vagrant::Util::Subprocess).to receive(:execute).with('ansible-playbook', any_args) { |*args|
|
||||||
|
inventory_content = File.read(generated_inventory_file)
|
||||||
|
|
||||||
|
expect(inventory_content).to include("[all:vars]\nvar1=value1\nvar2=value2\n")
|
||||||
|
|
||||||
|
}.and_return(default_execute_result)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "with host_key_checking option enabled" do
|
describe "with host_key_checking option enabled" do
|
||||||
|
|
Loading…
Reference in New Issue