fix inventory plugin

This commit is contained in:
Jörg Thalheim 2014-11-15 14:59:31 +01:00
parent b620ff03e1
commit baaee38387

View File

@ -11,8 +11,9 @@ json["network"].each do |host, data|
hostvars = { ansible_connection: "lxc", ansible_python_interpreter: "/usr/bin/python2" } hostvars = { ansible_connection: "lxc", ansible_python_interpreter: "/usr/bin/python2" }
hostvars.merge!(data["vars"]) if data["vars"] hostvars.merge!(data["vars"]) if data["vars"]
containers[role] ||= [] containers[role] ||= {}
containers[role] << host containers[role]["hosts"] ||= []
containers[role]["hosts"] << host
containers["_meta"]["hostvars"][host] = hostvars containers["_meta"]["hostvars"][host] = hostvars
end end
puts JSON.pretty_generate(containers) puts JSON.pretty_generate(containers)