Skip to content

Instantly share code, notes, and snippets.

@wolstena
Last active December 24, 2015 01:09
Show Gist options
  • Save wolstena/6722143 to your computer and use it in GitHub Desktop.
Save wolstena/6722143 to your computer and use it in GitHub Desktop.
Vangrant + Ansible
# -*- mode: ruby -*-
# vi: set ft=ruby :
hosts = {
"host0" => "192.168.33.10",
"host1" => "192.168.33.11",
"host2" => "192.168.33.12"
}
Vagrant.configure("2") do |config|
hosts.each do |name, ip|
config.vm.define name do |machine|
machine.vm.box = "precise32"
machine.vm.box_url = "http://files.vagrantup.com/precise32.box"
machine.vm.hostname = "%s.example.org" % name
machine.vm.network :private_network, ip: ip
machine.vm.provider "virtualbox" do |v|
v.name = name
v.customize ["modifyvm", :id, "--memory", 200]
end
config.vm.provision :ansible do |ansible|
ansible.sudo = true
ansible.playbook = 'provisioning/keys.yml'
end
end
end
-Make changes to /etc/network/interfaces (eg change dns servers)
-Multiple server auto-resolving port forwarding of 22.
-First run: authorized_keys
-If you don't specify a host file, how do you specify groups and roles. == via facts?
@wolstena
Copy link
Author

This causes me grief with the port forwarding for port 22. Does it need a pause or retry somewhere?

@wolstena
Copy link
Author

ansible -i vagrant_ansible_inventory_elasticsearch01 -m setup -vvv elasticsearch01 --ask-pass -u vagrant --sudo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment