Provision Multiple Virtual Puppet Slaves with Vagrant

For testing, it’s convenient to provision many virtual slave computers to your master.

This Vagrant file installs two virtual computers and automatically configures them as slaves to a puppetmaster in a predefined IP address.
Advanced stuff warning: Using this sample configuration requires fluency in command line, Puppet master-slave architecture and knowing the basics of vagrant and virtualbox.


# Multislave vagrant for Puppet
# Copyright 2017 Tero Karvinen
$tscript = <<TSCRIPT
set -o verbose
echo "See you on"
apt-get update
apt-get -y install puppet
grep ^server /etc/puppet/puppet.conf || echo -e "\n[agent]\nserver=teromaster\n" |sudo tee -a /etc/puppet/puppet.conf
grep teromaster /etc/hosts || echo -e "\n172.28.171.3 teromaster\n"|sudo tee -a /etc/hosts
puppet agent --enable
sudo service puppet start
sudo service puppet restart
Vagrant.configure(2) do |config| = "bento/ubuntu-16.04"
 config.vm.provision "shell", inline: $tscript
 config.vm.define "tero01" do |tero01|
 tero01.vm.hostname = "tero01"
 config.vm.define "tero02" do |tero02|
 tero02.vm.hostname = "tero02"
Posted in Uncategorized | Tagged , , , , , , , , , | Comments Off on Provision Multiple Virtual Puppet Slaves with Vagrant

Comments are closed.