Skip to content

Instantly share code, notes, and snippets.

@fnichol
Created November 16, 2012 19:42
Show Gist options
  • Save fnichol/4090228 to your computer and use it in GitHub Desktop.
Save fnichol/4090228 to your computer and use it in GitHub Desktop.
A Puppet Master!
site :opscode
# i heard you liked puppet
cookbook 'puppet'
require 'berkshelf/vagrant'
def oc_box_url(name)
"https://opscode-vm.s3.amazonaws.com/vagrant/boxes/#{name}.box"
end
def puppetmaster_ip
"172.16.33.31"
end
Vagrant::Config.run do |config|
config.vm.define :puppetmaster do |vm_config|
vm_config.vm.box = "opscode-ubuntu-12.04"
vm_config.vm.box_url = oc_box_url(vm_config.vm.box)
vm_config.vm.host_name = "puppetmaster.vagrantup.com"
vm_config.vm.network :hostonly, puppetmaster_ip
vm_config.vm.provision :chef_solo do |chef|
chef.run_list = [
"recipe[puppet::master]"
]
# normally a terrible thing to do (autosign=true), but only
# internally networked nodes will be talking to the server
chef.json = {
:puppet => {
:master_conf => {
:master => {
:autosign => 'true'
}
}
}
}
end
# set up all puppet nodes to be an apache web server
vm_config.vm.provision :shell, :inline => <<-PREPARE_MASTER.gsub(/^ {6}/, '')
puppet module install puppetlabs-apache
cat <<SITE_PP > /etc/puppet/manifests/site.pp
node default {
class { 'apache': }
}
SITE_PP
PREPARE_MASTER
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment