-
-
Save jbouse/25df268bced7a2cf09b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# This configuration requires Vagrant 1.5 or newer and three plugins: | |
# | |
# vagrant plugin install vagrant-hosts ~> 2.1.4 | |
# vagrant plugin install vagrant-auto_network ~> 1.0.0 | |
# vagrant plugin install vagrant-vbguest ~> 0.10.0 | |
# | |
# After installation, the following steps will spin up a master and agent that | |
# can communicate with each other: | |
# | |
# wget http://apt.puppetlabs.com/puppetlabs-release-stable.deb | |
# vagrant up | |
# vagrant ssh puppetagent | |
# sudo -i | |
# puppet agent -t | |
Vagrant.require_version ">= 1.5.0" | |
require 'vagrant-hosts' | |
require 'vagrant-auto_network' | |
require 'vagrant-vbguest' | |
Vagrant.configure('2') do |config| | |
config.vm.define :puppetmaster do |node| | |
# An index of pre-built boxes can be found at: | |
# | |
# https://vagrantcloud.com/puppetlabs | |
node.vm.box = 'puppetlabs/debian-7.6-64-nocm' | |
node.vm.hostname = 'puppetmaster.puppetdebug.vlan' | |
# Use vagrant-auto_network to assign an IP address. | |
node.vm.network :private_network, :auto_network => true | |
# Use vagrant-hosts to add entries to /etc/hosts for each virtual machine | |
# in this file. | |
node.vm.provision :hosts | |
# Bootstrap the latest version of Puppet on CentOS 6 and Set up a Puppet Master | |
# that automatically signs certs from agents. | |
# | |
# For operating systems other than CentOS 6, a collection of bootstrap | |
# scripts can be found here: | |
# | |
# https://github.com/hashicorp/puppet-bootstrap | |
# | |
# The Puppet Labs installation docs also have some useful pointers: | |
# | |
# http://docs.puppetlabs.com/guides/installation.html#installing-puppet-1 | |
bootstrap_script = <<-EOF | |
if which puppet > /dev/null 2>&1; then | |
echo 'Puppet Installed.' | |
else | |
echo 'Installing Puppet Master.' | |
dpkg -i /vagrant/puppetlabs-release-stable.deb | |
apt-get update | |
apt-get install -y puppetmaster | |
echo '*.puppetdebug.vlan' > /etc/puppet/autosign.conf | |
/usr/bin/puppet resource service puppetmaster ensure=running enable=true | |
fi | |
EOF | |
node.vm.provision :shell, :inline => bootstrap_script | |
end | |
config.vm.define :puppetagent do |node| | |
node.vm.box = 'puppetlabs/debian-7.6-64-nocm' | |
node.vm.hostname = 'puppetagent.puppetdebug.vlan' | |
node.vm.network :private_network, :auto_network => true | |
node.vm.provision :hosts | |
# Set up Puppet Agent to automatically connect with Puppet master | |
bootstrap_script = <<-EOF | |
if which puppet > /dev/null 2>&1; then | |
echo 'Puppet Installed.' | |
else | |
echo 'Installing Puppet Agent.' | |
dpkg -i /vagrant/puppetlabs-release-stable.deb | |
apt-get update | |
apt-get install -y puppet | |
puppet config set --section main server puppetmaster.puppetdebug.vlan | |
fi | |
EOF | |
node.vm.provision :shell, :inline => bootstrap_script | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment