diff --git a/CHANGELOG.md b/CHANGELOG.md index c3a5d95ad..95b11f648 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/plugins/provisioners/ansible/provisioner.rb b/plugins/provisioners/ansible/provisioner.rb index 215effd85..9dbb1b625 100644 --- a/plugins/provisioners/ansible/provisioner.rb +++ b/plugins/provisioners/ansible/provisioner.rb @@ -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