Setup the Ansible config so it works for multiple versions of Vagrant

Older versions of Vagrant used one static private key for ssh, newer
versions vary it by machine.

Change-Id: If2da96e20acc2e49764b77d67f53d8d2e3a9cbbd
This commit is contained in:
Tim Kuhlman 2015-02-27 17:05:07 -07:00
parent e6b8498708
commit b1ef59fd53
3 changed files with 6 additions and 15 deletions

View File

@ -1,2 +1,2 @@
devstack ansible_ssh_host=192.168.10.5 devstack
mini-mon ansible_ssh_host=192.168.10.4 mini-mon

View File

@ -141,17 +141,12 @@ your local ansible configuration (~/.ansible.cfg or a personal ansible.cfg in th
[defaults] [defaults]
hostfile = .ansible_hosts hostfile = .ansible_hosts
remote_user = vagrant
host_key_checking = False
# Note: For newer versions of Vagrant a single insecure_private_key isn't used, rather it is machine specific
# by modifying .ansible_hosts adding ansible_ssh_key_file to the end of the line you can configure the proper behavior.
# In that case leave out the private_key_file line below.
# For example `devstack ansible_ssh_host=192.168.10.5 ansible_ssh_private_key_file=.vagrant/machines/devstack/virtualbox/private_key`
private_key_file = ~/.vagrant.d/insecure_private_key
# In some configurations this won't work, use only if your config permits. # In some configurations this won't work, use only if your config permits.
#[ssh_connection] [ssh_connection]
#pipelining = True # Speeds up connections but only if requiretty is not enabled for sudo pipelining = True # Speeds up connections but only if requiretty is not enabled for sudo
Next run `vagrant ssh-config >> ~/.ssh/config`, that will set the correct users/host_keys for the vagrant vms.
### Editing Ansible Configuration ### Editing Ansible Configuration
Since there are only two VMs in this setup the Ansible configuration has no host or group variables, rather Since there are only two VMs in this setup the Ansible configuration has no host or group variables, rather

4
Vagrantfile vendored
View File

@ -35,8 +35,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end end
ds.vm.provision "ansible" do |ansible| ds.vm.provision "ansible" do |ansible|
ansible.playbook = "devstack.yml" ansible.playbook = "devstack.yml"
ansible.inventory_path = '.ansible_hosts'
ansible.host_key_checking = false
ansible.raw_arguments = ['-T 30', '-e pipelining=True'] ansible.raw_arguments = ['-T 30', '-e pipelining=True']
end end
end end
@ -52,8 +50,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end end
mm.vm.provision "ansible" do |ansible| mm.vm.provision "ansible" do |ansible|
ansible.playbook = "mini-mon.yml" ansible.playbook = "mini-mon.yml"
ansible.inventory_path = '.ansible_hosts'
ansible.host_key_checking = false
ansible.raw_arguments = ['-T 30', '-e pipelining=True'] ansible.raw_arguments = ['-T 30', '-e pipelining=True']
end end
end end