Skip to content

Instantly share code, notes, and snippets.

@v1k0d3n
Created August 17, 2016 19:22
Show Gist options
  • Save v1k0d3n/dfb36a1d44b9390dad199b71ae770402 to your computer and use it in GitHub Desktop.
Save v1k0d3n/dfb36a1d44b9390dad199b71ae770402 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/sytax version. Don’t touch unless you know what you’re doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Variable Definitions:
# ------------------------
#
ETD_COUNT = 2
WORKER_COUNT = 3
MASTER_COUNT = 2
# Guest Definitions:
# ------------------------
#
# Etcd Definition(s): START
for e in 1..ETD_COUNT
config.vm.define vm_name = "etcd#{e}" do |etcd_config|
etcd_config.vm.box = "ubuntu/xenial64"
etcd_config.vm.hostname = "etcd#{e}"
# NETWORK-SETTINGS: eth1 configured in the 192.168.236.0/24 network
etcd_config.vm.network "private_network", ip: "192.168.236.1#{e}"
etcd_config.vm.provider "virtualbox" do |vb|
etcd_config.vm.provision :ansible do |ansible|
# ansible.limit = "all"
ansible.playbook = "provisioning/vagrant-build.yml"
end
vb.name = "roto_etcd#{e}"
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--cpus", "1"]
end
end
end
# Master Definition(s): START
for m in 1..MASTER_COUNT
config.vm.define vm_name = "master#{m}" do |master_config|
master_config.vm.box = "ubuntu/xenial64"
master_config.vm.hostname = "master#{m}"
# NETWORK-SETTINGS: eth1 configured in the 192.168.236.0/24 network
master_config.vm.network "private_network", ip: "192.168.236.2 {m}"
master_config.vm.provider "virtualbox" do |vb|
master_config.vm.provision :ansible do |ansible|
# ansible.limit = "all"
ansible.playbook = "provisioning/vagrant-build.yml"
end
vb.name = "roto_master#{m}"
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--cpus", "1"]
end
end
end
# Worker Definition(s): START
for w in 1..WORKER_COUNT
config.vm.define vm_name = "worker#{w}" do |worker_config|
worker_config.vm.box = "ubuntu/xenial64"
worker_config.vm.hostname = "worker#{w}"
# NETWORK-SETTINGS: eth1 configured in the 192.168.236.0/24 network
worker_config.vm.network "private_network", ip: "192.168.236.3#{w}"
worker_config.vm.provider "virtualbox" do |vb|
worker_config.vm.provision :ansible do |ansible|
# ansible.limit = "all"
ansible.playbook = "provisioning/vagrant-build.yml"
end
vb.name = "roto_worker#{w}"
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--cpus", "1"]
end
end
end
end
@v1k0d3n
Copy link
Author

v1k0d3n commented Aug 17, 2016

bjozsa@megatron ~/p/g/v/astra-vagrant-demo ❯❯❯ vagrant status
Current machine states:

etcd1 not created (virtualbox)
etcd2 not created (virtualbox)
master1 not created (virtualbox)
master2 not created (virtualbox)
worker1 not created (virtualbox)
worker2 not created (virtualbox)
worker3 not created (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run vagrant status NAME.
bjozsa@megatron ~/p/g/v/astra-vagrant-demo ❯❯❯

@v1k0d3n
Copy link
Author

v1k0d3n commented Aug 17, 2016

INFO interface: error: A VirtualBox machine with the name 'ubuntu-xenial-16.04-cloudimg' already exists.
Please use another name or delete the machine with the existing
name, and try again.
A VirtualBox machine with the name 'ubuntu-xenial-16.04-cloudimg' already exists.
Please use another name or delete the machine with the existing
name, and try again.
INFO interface: Machine: error-exit ["Vagrant::Errors::VMNameExists", "A VirtualBox machine with the name 'ubuntu-xenial-16.04-cloudimg' already exists.\nPlease use another name or delete the machine with the existing\nname, and try again."]
bjozsa@megatron ~/p/g/v/astra-vagrant-demo ❯❯❯

@chrisroberts
Copy link

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/sytax version. Don’t touch unless you know what you’re doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  # Variable Definitions:
  # ------------------------
  #
  ETD_COUNT = 2
  WORKER_COUNT = 3
  MASTER_COUNT = 2

  # Guest Definitions:
  # ------------------------
  #

  # Etcd Definition(s): START
  ETD_COUNT.times do |e|
    config.vm.define vm_name = "etcd#{e}" do |etcd_config|
      etcd_config.vm.box = "ubuntu/xenial64"
      etcd_config.vm.hostname = "etcd#{e}"
      # NETWORK-SETTINGS: eth1 configured in the 192.168.236.0/24 network
      etcd_config.vm.network "private_network", ip: "192.168.236.1#{e}"
      etcd_config.vm.provider "virtualbox" do |vb|
        vb.name = "roto_etcd#{e}"
        vb.customize ["modifyvm", :id, "--memory", "512"]
        vb.customize ["modifyvm", :id, "--cpus", "1"]
      end
    end
  end
end

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