From b1ef59fd5317467eb910cd84b9d0701bf0cf8ebf Mon Sep 17 00:00:00 2001 From: Tim Kuhlman Date: Fri, 27 Feb 2015 17:05:07 -0700 Subject: [PATCH] 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 --- .ansible_hosts | 4 ++-- README.md | 13 ++++--------- Vagrantfile | 4 ---- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.ansible_hosts b/.ansible_hosts index bf5f4ba..6d72083 100644 --- a/.ansible_hosts +++ b/.ansible_hosts @@ -1,2 +1,2 @@ -devstack ansible_ssh_host=192.168.10.5 -mini-mon ansible_ssh_host=192.168.10.4 +devstack +mini-mon diff --git a/README.md b/README.md index 45bae23..3ac0796 100644 --- a/README.md +++ b/README.md @@ -141,17 +141,12 @@ your local ansible configuration (~/.ansible.cfg or a personal ansible.cfg in th [defaults] 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. - #[ssh_connection] - #pipelining = True # Speeds up connections but only if requiretty is not enabled for sudo + [ssh_connection] + 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 Since there are only two VMs in this setup the Ansible configuration has no host or group variables, rather diff --git a/Vagrantfile b/Vagrantfile index 6a7c066..294f97a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -35,8 +35,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end ds.vm.provision "ansible" do |ansible| ansible.playbook = "devstack.yml" - ansible.inventory_path = '.ansible_hosts' - ansible.host_key_checking = false ansible.raw_arguments = ['-T 30', '-e pipelining=True'] end end @@ -52,8 +50,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end mm.vm.provision "ansible" do |ansible| ansible.playbook = "mini-mon.yml" - ansible.inventory_path = '.ansible_hosts' - ansible.host_key_checking = false ansible.raw_arguments = ['-T 30', '-e pipelining=True'] end end