-
-
Save Fettah/9f1b8cf1f153fc827ca8f068dd69373d to your computer and use it in GitHub Desktop.
Revisions
-
rezroo revised this gist
Apr 4, 2019 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -33,17 +33,17 @@ $global = <<SCRIPT #check for private key for vm-vm comm [ -f /vagrant/id_rsa ] || { ssh-keygen -t rsa -f /vagrant/id_rsa -q -N '' -C vagrant@master } #deploy key [ -f ${HOME}/.ssh/id_rsa ] || { cp /vagrant/id_rsa ${HOME}/.ssh/id_rsa chmod 0600 ${HOME}/.ssh/id_rsa } #allow ssh passwordless grep 'vagrant@master' ~/.ssh/authorized_keys &>/dev/null || { cat /vagrant/id_rsa.pub >> ~/.ssh/authorized_keys chmod 0600 ~/.ssh/authorized_keys } -
rezroo revised this gist
Apr 3, 2019 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -76,6 +76,14 @@ Vagrant.configure("2") do |config| node.vm.hostname = vm_name ip=opts[:eth1] node.vm.network "private_network", ip: ip config.vm.provider "vmware_fusion" do |v| v.vmx["memsize"] = opts[:mem] v.vmx["numvcpus"] = opts[:cpu] end config.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--memory", opts[:mem]] v.customize ["modifyvm", :id, "--cpus", opts[:cpu]] end end end end -
rezroo revised this gist
Apr 3, 2019 . 1 changed file with 39 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,32 @@ # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.require_version ">= 1.6.0" baseip="192.168.187" boxes = [ { :name => "master", :eth1 => "#{baseip}.#{10}", :mem => "2048", :cpu => "2" }, { :name => "node1", :eth1 => "#{baseip}.#{11}", :mem => "1024", :cpu => "1" }, { :name => "node2", :eth1 => "#{baseip}.#{12}", :mem => "1024", :cpu => "1" } ] numnodes=boxes.size #global script $global = <<SCRIPT @@ -10,13 +37,13 @@ $global = <<SCRIPT } #deploy key [ -f /home/ubuntu/.ssh/id_rsa ] || { cp /vagrant/id_rsa /home/ubuntu/.ssh/id_rsa chmod 0600 /home/ubuntu/.ssh/id_rsa } #allow ssh passwordless grep 'ubuntu@master' ~/.ssh/authorized_keys &>/dev/null || { cat /vagrant/id_rsa.pub >> ~/.ssh/authorized_keys chmod 0600 ~/.ssh/authorized_keys } @@ -29,7 +56,7 @@ Host node* EOF #populate /etc/hosts for x in {11..#{10+numnodes-1}}; do grep #{baseip}.${x} /etc/hosts &>/dev/null || { echo #{baseip}.${x} node${x##?} | sudo tee -a /etc/hosts &>/dev/null } @@ -39,16 +66,16 @@ done SCRIPT Vagrant.configure("2") do |config| config.vm.box = "ubuntu/xenial64" config.vm.provision "shell", privileged: false, inline: $global prefix="node" #node box boxes.each do |opts| vm_name = opts[:name] config.vm.define vm_name do |node| node.vm.hostname = vm_name ip=opts[:eth1] node.vm.network "private_network", ip: ip end end end -
kikitux revised this gist
Oct 31, 2017 . 1 changed file with 11 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,10 @@ numnodes=2 baseip="192.168.10" #global script $global = <<SCRIPT #check for private key for vm-vm comm [ -f /vagrant/id_rsa ] || { ssh-keygen -t rsa -f /vagrant/id_rsa -q -N '' } @@ -23,13 +21,21 @@ grep 'vagrant@node' ~/.ssh/authorized_keys &>/dev/null || { chmod 0600 ~/.ssh/authorized_keys } #exclude node* from host checking cat > ~/.ssh/config <<EOF Host node* StrictHostKeyChecking no UserKnownHostsFile=/dev/null EOF #populate /etc/hosts for x in {11..#{10+numnodes}}; do grep #{baseip}.${x} /etc/hosts &>/dev/null || { echo #{baseip}.${x} node${x##?} | sudo tee -a /etc/hosts &>/dev/null } done #end script SCRIPT Vagrant.configure("2") do |config| @@ -45,6 +51,4 @@ Vagrant.configure("2") do |config| node.vm.network "private_network", ip: ip end end end -
kikitux created this gist
Oct 31, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ numnodes=2 baseip="192.168.10" #global script $global = <<SCRIPT #write numnodes echo #{numnodes} > /vagrant/numnodes #check for private key for vm-vm [ -f /vagrant/id_rsa ] || { ssh-keygen -t rsa -f /vagrant/id_rsa -q -N '' } #deploy key [ -f /home/vagrant/.ssh/id_rsa ] || { cp /vagrant/id_rsa /home/vagrant/.ssh/id_rsa chmod 0600 /home/vagrant/.ssh/id_rsa } #allow ssh passwordless grep 'vagrant@node' ~/.ssh/authorized_keys &>/dev/null || { cat /vagrant/id_rsa.pub >> ~/.ssh/authorized_keys chmod 0600 ~/.ssh/authorized_keys } #populate /etc/hosts for x in {11..#{10+numnodes}}; do grep #{baseip}.${x} /etc/hosts &>/dev/null || { echo #{baseip}.${x} node${x##?} | sudo tee -a /etc/hosts &>/dev/null } done SCRIPT Vagrant.configure("2") do |config| config.vm.provision "shell", privileged: false, inline: $global prefix="node" #node box (1..numnodes).each do |i| vm_name = "#{prefix}#{i}" config.vm.define vm_name do |node| node.vm.box = "hashicorp/precise64" node.vm.hostname = vm_name ip="#{baseip}.#{10+i}" node.vm.network "private_network", ip: ip end end end