Skip to content

Instantly share code, notes, and snippets.

@deep9
Created December 4, 2013 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deep9/7789460 to your computer and use it in GitHub Desktop.
Save deep9/7789460 to your computer and use it in GitHub Desktop.
# Lets tell Puppet the order of our stages
stage {
'users': before => Stage['repos'];
'repos': before => Stage['updates'];
'updates': before => Stage['packages'];
'packages': before => Stage['configure'];
'configure': before => Stage['services'];
'services': before => Stage['main'];
}
class services {
#we want apache and mongo to be running when the server boots
service {
'mongodb':
ensure => running,
enable => true
}
}
class configure {
#add any custom stuff here please
}
class packages {
package {
#add your packages here
"mongodb-10gen": ensure => "present"; # MongoDB
}
}
class updates {
# We must run apt-get update before we install our packaged because we installed some repo's
exec { "apt-update":
command => "/usr/bin/apt-get update -y -q",
timeout => 0
}
}
class repos {
#lets install some repos
exec {
"get-mongo-key" :
command => "/usr/bin/apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10",
unless => "/usr/bin/apt-key list| /bin/grep -c 10gen";
"install-mongo-repo":
command => "/bin/echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' >> /etc/apt/sources.list",
unless => "/bin/grep 'http://downloads-distro.mongodb.org/repo/ubuntu-upstart' -c /etc/apt/sources.list";
}
}
class users
{
group { "puppet":
ensure => "present",
}
}
class {
users: stage => "users";
repos: stage => "repos";
updates: stage => "updates";
packages: stage => "packages";
configure: stage => "configure";
services: stage => "services";
}
Vagrant::Config.run do |config|
config.vm.box = "lucid32"
config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
config.vm.network :hostonly, "10.0.0.2"
config.vm.forward_port 27017, 27017
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "."
puppet.manifest_file = "puppet.pp"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment