ansible: generate inventory in .vagrant/...
This commit is contained in:
parent
d5055c6252
commit
1cd2fe56a0
|
@ -71,8 +71,9 @@ module VagrantPlugins
|
||||||
# Managed machines
|
# Managed machines
|
||||||
inventory_machines = {}
|
inventory_machines = {}
|
||||||
|
|
||||||
generated_inventory_file =
|
generated_inventory_dir = @machine.env.local_data_path.join(File.join(%w(provisioners ansible inventory)))
|
||||||
@machine.env.root_path.join("vagrant_ansible_inventory")
|
FileUtils.mkdir_p(generated_inventory_dir) unless File.directory?(generated_inventory_dir)
|
||||||
|
generated_inventory_file = generated_inventory_dir.join('vagrant_ansible_inventory')
|
||||||
|
|
||||||
generated_inventory_file.open('w') do |file|
|
generated_inventory_file.open('w') do |file|
|
||||||
file.write("# Generated by Vagrant\n\n")
|
file.write("# Generated by Vagrant\n\n")
|
||||||
|
|
|
@ -33,8 +33,7 @@ there are two ways to approach working with inventory files.
|
||||||
|
|
||||||
The first and simplest option is to not provide one to Vagrant at all. Vagrant will generate an
|
The first and simplest option is to not provide one to Vagrant at all. Vagrant will generate an
|
||||||
inventory file encompassing all of the virtual machine it manages, and use it for provisioning
|
inventory file encompassing all of the virtual machine it manages, and use it for provisioning
|
||||||
machines. The generated inventory file is created adjacent to your Vagrantfile, named
|
machines. The generated inventory file is stored as part of your local Vagrant environment in `.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory`.
|
||||||
`vagrant_ansible_inventory`.
|
|
||||||
|
|
||||||
The `ansible.groups` option can be used to pass a hash of group
|
The `ansible.groups` option can be used to pass a hash of group
|
||||||
names and group members to be included in the generated inventory file. Group variables
|
names and group members to be included in the generated inventory file. Group variables
|
||||||
|
|
Loading…
Reference in New Issue