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.

Vagrantfile

# Multislave vagrant for Puppet
# Copyright 2017 Tero Karvinen http://TeroKarvinen.com

$tscript = <<TSCRIPT
set -o verbose
echo "See you on http://TeroKarvinen.com"
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
TSCRIPT

Vagrant.configure(2) do |config|

 config.vm.box = "bento/ubuntu-16.04"
 config.vm.provision "shell", inline: $tscript

 config.vm.define "tero01" do |tero01|
 tero01.vm.hostname = "tero01"
 end

 config.vm.define "tero02" do |tero02|
 tero02.vm.hostname = "tero02"
 end

end
Posted in Uncategorized | Tagged , , , , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Picks

  • Boxing Clock for AndroidOcton8 Diving T-ShirtsShaking Tower Panda Android GameLearn Chinese with Android
  • Student projects