Vagrant, Saltstack & “saltyvagrant”

I was banging against Vagrant’s preferred way of doing salt deployments. Horrible nasty huge bash scripts that cater for every possibility.

I just wanted to spin up: 

  • a reasonably modern Ubuntu version
  • set it up as a master/minion on the same machine
  • copy in my salt master config and my salt minion config
  • call salt -v "*" state.highstate

Strange things would fail. I was filled with sadness.

Then I fixed things.

Add the following lines to your Vagrantfile:

#!/bin/sh
export DEBIAN_FRONTEND=noninteractive
apt-get --yes -q install python-software-properties
add-apt-repository ppa:saltstack/salt2015-5 -y
apt-get --yes -q update
mkdir /etc/salt
apt-get --yes -q install python-git salt-master salt-minion
cp /srv/vagrant_salt_bootstrap/master /etc/salt/master
cp /srv/vagrant_salt_bootstrap/minion /etc/salt/minion
restart salt-minion
restart salt-master
sleep 10
salt-key -y -a '*'
sleep 10
salt -v "*" state.highstate -l debug

call this from your Vagrantfile with the following configuration:

config.vm.synced_folder "saltstack/vagrant_salt_bootstrap", "/srv/vagrant_salt_bootstrap"
config.vm.provision :shell, :inline => "sudo /srv/vagrant_salt_bootstrap/bootstrap.sh"

You can see it in action in the buddycloud-vm project.

Related Articles

search

Powered by Blogger.

Follow by Email

Should anyone ask, on building strong teams

My thinking about building strong teams My work goal is: work with smart people, on interesting problems, that improve our lives. So I start...