Created
April 6, 2020 09:12
-
-
Save thamaraiselvam/a38a93ab702e91ba522b276b83988d21 to your computer and use it in GitHub Desktop.
create ubuntu instance on local
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$setup_consul = <<-SCRIPT | |
#! /bin/sh | |
echo "Installing required packages..." | |
sudo apt-get update | |
# Other Packages required | |
sudo apt-get install wget unzip curl vim -y | |
wget https://releases.hashicorp.com/consul/1.6.2/consul_1.6.2_linux_amd64.zip -O consul.zip | |
unzip consul.zip | |
sudo chmod +x consul | |
sudo mv consul /usr/local/bin | |
echo "Installed consul binary" | |
SCRIPT | |
VAGRANTFILE_API_VERSION = "2" | |
NUM_OF_NODES = 5 | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "ubuntu/xenial64" | |
config.vm.provider "virtualbox" do |v| | |
v.memory = 512 | |
v.cpus = 1 | |
end | |
config.vm.provision :shell, inline: "echo 'Hello World!'" | |
(1..NUM_OF_NODES).each do |i| | |
config.vm.define "node#{i}" do |node| | |
node.vm.network "private_network", ip: "192.168.1.#{i+1}" | |
node.vm.hostname = "machine#{i}" | |
node.vm.provision :shell, inline: $setup_consul | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment