Skip to content

Instantly share code, notes, and snippets.

@earthnuker
Created August 23, 2017 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save earthnuker/664be7c10d316fe420926ba4b62ef9fb to your computer and use it in GitHub Desktop.
Save earthnuker/664be7c10d316fe420926ba4b62ef9fb to your computer and use it in GitHub Desktop.
Vagrant, Anaconda+Salt Cluster
until sudo apt-get update -y; do sleep 1; done
until sudo apt-get install -y avahi-daemon avahi-discover avahi-utils libnss-mdns mdns-scan zsh; do sleep 1; done
mkdir .antigen
until curl -qL https://git.io/antigen > ./.antigen/antigen.zsh; do sleep 1; done;
cat > .zshrc <<EOF
source ~/.antigen/antigen.zsh
antigen use oh-my-zsh
antigen bundle command-not-found
antigen bundle zsh-users/zsh-syntax-highlighting
antigen theme gentoo
antigen apply
export PATH=\$PATH:\$HOME/miniconda3/bin
EOF
sudo chsh -s $(which zsh) vagrant
until curl -qL https://bootstrap.saltstack.com > install_salt.sh; do sleep 1; done;
until curl -qL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh > miniconda3.sh; do sleep 1; done;
bash ./miniconda3.sh -b
export PATH=$PATH:$HOME/miniconda3/bin
conda install anaconda paramiko -y -q
# -*- mode: ruby -*-
# vi: set ft=ruby :
num_nodes=4
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, path: "bootstrap.sh", privileged: false
config.vm.provider "virtualbox" do |v|
v.linked_clone = true
v.cpus = 1
v.memory = 1024
end
config.vm.provision :salt do |salt|
salt.verbose = true
end
# virtualbox__intnet: "HPC"
config.vm.define "master", primary: true do |master|
master.vm.hostname = "master.local"
master.vm.network "private_network", type: "dhcp"
master.vm.provision :shell, inline: "sudo sh install_salt.sh -MA master.local"
master.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--name", "master"]
end
end
(1..num_nodes).each do |node_id|
config.vm.define "node-#{node_id}" do |node|
node.vm.hostname = "node-#{node_id}.local"
node.vm.network "private_network", type: "dhcp"
node.vm.provision :shell, inline: "sudo sh install_salt.sh -A master.local"
node.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--name", "node-#{node_id}"]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment