Automatically Provision Vagrant Virtual Machines as Salt Slaves

Create a new, fully configured virtual computer in less than a minute. Keep configuration in version control. Manage trough configuration management system.

This short example only contains Vagrantfile for slave. This configures new vagrant virtual machine as salt slave. You will also need a working salt master to use this.
This short example is not aimed at beginners. Prerequisites: Linux command line, salt configuration management system and vagrant virtualization.

Vagrantfile

# Vagrantfile
# Copyright 2018 Tero Karvinen http://TeroKarvinen.com
# Based on http://terokarvinen.com/2017/provision-multiple-virtual-puppet-slaves-with-vagrant
$tscript = <<TSCRIPT
touch /tmp/terokarvinen.com
sudo apt-get update
sudo apt-get -y install salt-minion
echo -e 'master: 10.0.2.2\nid: tero001'|sudo tee /etc/salt/minion
sudo systemctl restart salt-minion
TSCRIPT
Vagrant.configure("2") do |config|
 config.vm.box = "bento/ubuntu-16.04"
 config.vm.provision "shell", inline: $tscript
end

What Next?

See how my student Jussi Isosomppi used similar configuration to control over two thousand slaves (git repository).

Posted in Uncategorized | Tagged , , , , , | Comments Off on Automatically Provision Vagrant Virtual Machines as Salt Slaves

Comments are closed.