30 September 2014

There is some likelyhood that the combination of Salt and Vagrant will be useful to me in the near future, so I started to experiment with it, and it’s all pretty nice.

This file

This org-mode file exists on a pretend computer, called minion, that is controlled by another pretend computer called master. These two pretend computers are both running Linux. The two pretend computers are running on a real MacBook Air and are managed by Vagrant. The minion is controlled by the master via Salt.

There are literally billions of people in the world to whom the previous paragraph makes no sense.

Making pretend masters and minions

  • Install VirtualBox
  • Install Vagrant
  • Install XCode
  • Follow the instructions at https://github.com/dotless-de/vagrant-vbguest to make sure your VirtualBox guest additions match—this is important to make the directory that is shared with the guests (master and minion) work with the host. If you have XCode and some luck on your side, the command:
    vagrant plugin install vagrant-vbguest
    

    will do the trick.

  • Follow the instructions at http://humankeyboard.com/saltstack/2014/saltstack-virtualbox-vagrant.html but add sudo where needed, because they aren’t in the document everywhere I expected them to be.
  • Don’t worry about the bunch of Salt errors from the minion provisioning, Salt still works. What matters is that test.ping works from the master:
    You@Your-Computer$ vagrant ssh master
    [...]
    vagrant@master:~$ sudo salt minion test.ping
    minion:
        True
    

    If you see that, Salt commands will work. I think if you had a state tree, you wouldn’t see those errors, but I haven’t tested that yet.

Salting the minion

Obviously, you want to install Emacs and Org-mode on the minion. To do that, create a file on the master called /srv/salt/emacs.sls that contains:

emacs:
   pkg.installed
org-mode:
   pkg.installed

Then type: vagrant@master:~$ sudo salt minion state.sls emacs and wait. When it’s done, you’ll get a report of all of the things that were installed (there are a lot of them), but then you can log into the minion and run the Proper Command.

You@Your-Computer$ vagrant ssh minion
[...]
vagrant@minion:~$ emacs -f org-mode

and you’ll be so happy.