plugins/provisioners: put generated inventory file in vagrantfile dir

This commit is contained in:
Mitchell Hashimoto 2013-08-28 16:54:44 -07:00
parent 8445308830
commit adb72b07d5
2 changed files with 9 additions and 4 deletions

View File

@ -20,8 +20,10 @@ IMPROVEMENTS:
- guests/suse: Supports private/public networks. [GH-1689]
- hosts/fedora: Support RHEL as a host. [GH-2088]
- provisioners/ansible: Ansible `inventory_path` can be a directory now. [GH-2035]
- provisoiners/ansible: Extra verbose option by setting `config.verbose`
- provisioners/ansible: Extra verbose option by setting `config.verbose`
to `extra`. [GH-1979]
- provisioners/ansible: `inventory_path` will be auto-generated if not
specified. [GH-1907]
BUG FIXES:

View File

@ -62,13 +62,16 @@ module VagrantPlugins
return config.inventory_file if config.inventory_file
ssh = @machine.ssh_info
generated_inventory_file = "vagrant_ansible_inventory_#{machine.name}"
File.open(generated_inventory_file, 'w') do |file|
generated_inventory_file =
@machine.env.root_path.join("vagrant_ansible_inventory_#{machine.name}")
generated_inventory_file.open('w') do |file|
file.write("# Generated by Vagrant\n\n")
file.write("#{machine.name} ansible_ssh_host=#{ssh[:host]} ansible_ssh_port=#{ssh[:port]}\n")
end
return generated_inventory_file
return generated_inventory_file.to_s
end
end
end