Skip to content

Instantly share code, notes, and snippets.

@vadikgo
Created February 9, 2017 12:43
Show Gist options
  • Save vadikgo/04ee44e517e7f21c0565c3d8595c3432 to your computer and use it in GitHub Desktop.
Save vadikgo/04ee44e517e7f21c0565c3d8595c3432 to your computer and use it in GitHub Desktop.
Vagrant file with ansible dynamic inventory
# -*- mode: ruby -*-
# vi: set ft=ruby :
hosts = [ "minio1", "minio2", "minio3", "minio4" ]
Vagrant.configure(2) do |config|
hosts.each_with_index do |name, num|
config.vm.define name do |machine|
machine.vm.box = "parallels/centos-7.3"
machine.vm.provider "parallels" do |v|
v.name = name
v.memory = "1024"
v.linked_clone = true
v.update_guest_tools = false
v.check_guest_tools = false
v.customize ["set", :id, "--sh-app-guest-to-host", "off"]
v.customize ["set", :id, "--shared-cloud", "off"]
v.customize ["set", :id, "--shared-profile", "off"]
v.customize ["set", :id, "--time-sync", "on"]
end
machine.vm.hostname = name
machine.vm.network :forwarded_port, guest: 9000, host: 9000+num
if num == hosts.size-1
machine.vm.provision "ansible" do |ansible|
ansible.config_file = "tests/ansible.cfg"
ansible.verbose = "v"
ansible.limit = "all"
ansible.groups = {
"minio" => hosts
}
ansible.playbook = "tests/test.yml"
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment