1
0
mirror of https://github.com/geerlingguy/ansible-for-devops.git synced 2024-05-19 06:50:03 +00:00
Files

42 lines
1.1 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "geerlingguy/debian9"
config.ssh.insert_key = false
config.vm.provider "virtualbox"
config.vm.provider :virtualbox do |v|
v.memory = 1536
v.cpus = 1
v.linked_clone = true
end
# Define three VMs with static private IP addresses.
boxes = [
{ :name => "master", :ip => "192.168.56.2" },
{ :name => "node1", :ip => "192.168.56.3" },
{ :name => "node2", :ip => "192.168.56.4" },
]
# Provision each of the VMs.
boxes.each do |opts|
config.vm.define opts[:name] do |config|
config.vm.hostname = opts[:name] + ".k8s.test"
config.vm.network :private_network, ip: opts[:ip]
# Provision all the VMs using Ansible after last VM is up.
if opts[:name] == "node2"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "main.yml"
ansible.inventory_path = "inventory"
ansible.limit = "all"
end
end
end
end
end