├── .gitignore ├── LICENSE ├── README.md ├── TODO ├── Vagrantfile ├── modules └── helloworld │ └── manifests │ └── init.pp └── provision ├── manifests └── default.pp └── modules ├── networking ├── manifests │ └── init.pp └── templates │ └── hosts.erb ├── puppet ├── files │ ├── nodes.pp │ ├── puppet.conf │ └── site.pp ├── manifests │ ├── apt_pin.pp │ ├── init.pp │ ├── params.pp │ └── server.pp └── templates │ └── puppet_apt_pin.pref.erb ├── repos ├── manifests │ ├── apt.pp │ ├── init.pp │ └── yum.pp └── templates │ ├── puppetlabs.list.erb │ └── puppetlabs.repo.erb └── vagrant └── manifests └── init.pp /.gitignore: -------------------------------------------------------------------------------- 1 | nodes.pp 2 | modules/* 3 | .vagrant 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Aaron Bull Schaefer 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Description 2 | =========== 3 | 4 | Puppet Sandbox is a multi-VM [Vagrant](http://vagrantup.com/)-based Puppet 5 | development environment used for creating and testing new modules outside 6 | of your production environment. It is prefered over the upstream [Learning 7 | Puppet VM](http://info.puppetlabs.com/download-learning-puppet-VM.html) as 8 | it gives you more flexibility and allows you to use your own local editing 9 | environment and tools. 10 | 11 | Puppet Sandbox will set up three separate virtual machines: 12 | 13 | * _puppet.example.com_ - the Puppet master server 14 | * _client1.example.com_ - the first Puppet client machine 15 | * _client2.example.com_ - the second Puppet client machine 16 | 17 | These VMs can be used in conjunction to segregate and test your modules 18 | based on node roles, Puppet environments, etc. You can even test modules 19 | on different Linux distributions or release versions to better match your 20 | production infrastructure. 21 | 22 | **Check out the [Puppet Sandbox Demonstration](http://vimeo.com/elasticdog/puppet-sandbox-demo) 23 | screencast for a brief overview of the project.** 24 | 25 | Requirements 26 | ============ 27 | 28 | To use Puppet Sandbox, you must have the following items installed and working: 29 | 30 | * [VirtualBox](https://www.virtualbox.org/) 31 | * [Vagrant 1.1+](http://vagrantup.com/) 32 | 33 | Puppet Sandbox has been designed for and tested with Vagrant base boxes running: 34 | 35 | * CentOS 6.3 36 | * CentOS 5.8 37 | * Ubuntu 12.04 - Precise Pangolin 38 | * Ubuntu 10.04 - Lucid Lynx 39 | 40 | ...although it may work just fine with other distributions/versions. 41 | 42 | Usage 43 | ===== 44 | 45 | Make sure you have a compatible Vagrant base box (if you don't have one 46 | already, it will download a 64-bit Ubuntu 12.04 box for you), and then you 47 | should be good to clone this repo and go: 48 | 49 | $ vagrant box list 50 | precise64 51 | $ git clone git://github.com/elasticdog/puppet-sandbox.git 52 | $ cd puppet-sandbox/ 53 | 54 | If you want a CentOS base box to work from, I highly recommend the boxes 55 | published by Jan Vansteenkiste: http://packages.vstone.eu/vagrant-boxes/ 56 | 57 | Initial Startup 58 | --------------- 59 | 60 | To bring up the Puppet Sandbox environment, issue the following command: 61 | 62 | $ vagrant up 63 | 64 | The following tasks will be handled automatically: 65 | 66 | 1. The Puppet server daemon will be installed and enabled on the master 67 | machine. 68 | 2. The Puppet client agent will be installed and enabled on all three machines. 69 | 3. A host-only network will be set up with all machines knowing how to 70 | communicate with each other. 71 | 4. All client certificate requests will be automatically signed by the master 72 | server. 73 | 5. The master server will utilize the `nodes.pp` file and `modules/` directory 74 | that exist **outside of the VMs** (in your puppet-sandbox Git working 75 | directory) by utilizing VirtualBox's shared folder feature. 76 | 77 | All of this is handled using Vagrant's provisioning capabilities and is 78 | controlled by the manifests under the `provision/` directory. In theory, you 79 | should never have to touch any of that code directly unless you're working to 80 | improve Puppet Sandbox. 81 | 82 | If you wish to change the domain name of the VMs (it defaults to 83 | _example.com_), edit the "domain" variable at the top of `Vagrantfile` and 84 | reload the machines: 85 | 86 | $ vim Vagrantfile 87 | $ vagrant reload 88 | 89 | Developing New Modules 90 | ---------------------- 91 | 92 | To start developing a new Puppet module, just create the standard module 93 | structure under `modules/` in your puppet-sandbox Git working directory (an 94 | example "helloworld" module should exist there already). This directory is 95 | automatically in the Puppet master server's _modulepath_, and any changes will 96 | be picked up immediately. 97 | 98 | $ mkdir -p modules/users/manifests 99 | $ vim modules/users/manifests/init.pp 100 | 101 | To have your module actually applied to one or more of the nodes, edit the 102 | `nodes.pp` file and include your classes...that's it! 103 | 104 | Check Your Handiwork 105 | -------------------- 106 | 107 | To log on to the virtual machines and see the result of your applied Puppet 108 | modules, just use standard [Vagrant Multi-VM 109 | Environment](https://docs.vagrantup.com/v2/multi-machine/index.html) commands, and provide the 110 | proper VM name (`master`, `client1`, or `client2`): 111 | 112 | $ vagrant ssh client1 113 | 114 | If you don't want to wait for the standard 30-minutes between Puppet runs by 115 | the agent daemon, you can easily force a manual run: 116 | 117 | [vagrant@client1 ~]$ sudo puppet agent --test 118 | 119 | License 120 | ======= 121 | 122 | Puppet Sandbox is provided under the terms of [The MIT 123 | License](http://www.opensource.org/licenses/MIT). 124 | 125 | Copyright © 2012, [Aaron Bull Schaefer](mailto:aaron@elasticdog.com). 126 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | * Support Arch Linux 2 | * Add an easy way to specify desired Puppet version 3 | * Make hosts file dynamic based on what is defined in Vagrantfile 4 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | domain = 'example.com' 5 | box = 'ubuntu/trusty64' 6 | ram = 512 7 | 8 | puppet_nodes = [ 9 | {:hostname => 'puppet', :ip => '172.16.32.10', :box => box, :fwdhost => 8140, :fwdguest => 8140, :ram => ram}, 10 | {:hostname => 'client1', :ip => '172.16.32.11', :box => box}, 11 | {:hostname => 'client2', :ip => '172.16.32.12', :box => box}, 12 | ] 13 | 14 | Vagrant.configure("2") do |config| 15 | puppet_nodes.each do |node| 16 | config.vm.define node[:hostname] do |node_config| 17 | node_config.vm.box = node[:box] 18 | node_config.vm.box_url = 'https://vagrantcloud.com/' + node_config.vm.box 19 | node_config.vm.hostname = node[:hostname] + '.' + domain 20 | node_config.vm.network :private_network, ip: node[:ip] 21 | 22 | if node[:fwdhost] 23 | node_config.vm.network :forwarded_port, guest: node[:fwdguest], host: node[:fwdhost] 24 | end 25 | 26 | memory = node[:ram] ? node[:ram] : 256; 27 | node_config.vm.provider :virtualbox do |vb| 28 | vb.customize [ 29 | 'modifyvm', :id, 30 | '--name', node[:hostname], 31 | '--memory', memory.to_s 32 | ] 33 | end 34 | 35 | node_config.vm.provision :puppet do |puppet| 36 | puppet.manifests_path = 'provision/manifests' 37 | puppet.module_path = 'provision/modules' 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /modules/helloworld/manifests/init.pp: -------------------------------------------------------------------------------- 1 | # == Class: helloworld 2 | # 3 | # This class is a bare bones example to ensure puppet master/clients are 4 | # talking to each other. 5 | # 6 | # === Parameters 7 | # 8 | # === Actions 9 | # 10 | # === Requires 11 | # 12 | # === Sample Usage 13 | # 14 | # class { 'helloworld': } 15 | # 16 | class helloworld { 17 | 18 | file { '/tmp/hello': 19 | owner => 'root', 20 | group => 'root', 21 | mode => '0666', 22 | content => "world\n", 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /provision/manifests/default.pp: -------------------------------------------------------------------------------- 1 | # 2 | # site.pp - defines defaults for vagrant provisioning 3 | # 4 | 5 | # use run stages for minor vagrant environment fixes 6 | stage { 'pre': before => Stage['main'] } 7 | 8 | class { 'repos': stage => 'pre' } 9 | class { 'vagrant': stage => 'pre' } 10 | 11 | class { 'puppet': } 12 | class { 'networking': } 13 | 14 | if $hostname == 'puppet' { 15 | class { 'puppet::server': } 16 | } 17 | -------------------------------------------------------------------------------- /provision/modules/networking/manifests/init.pp: -------------------------------------------------------------------------------- 1 | # == Class: networking 2 | # 3 | # This class configures the hosts file to allow communication between the 4 | # puppet master and puppet clients using the VirtualBox host-only network. 5 | # 6 | # === Parameters 7 | # 8 | # === Actions 9 | # 10 | # - Install custom hosts template 11 | # 12 | # === Requires 13 | # 14 | # === Sample Usage 15 | # 16 | # class { 'networking': } 17 | # 18 | class networking { 19 | 20 | file { '/etc/hosts': 21 | owner => 'root', 22 | group => 'root', 23 | mode => '0644', 24 | content => template('networking/hosts.erb'), 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /provision/modules/networking/templates/hosts.erb: -------------------------------------------------------------------------------- 1 | 127.0.0.1 localhost 2 | 127.0.1.1 <%= @fqdn %> 3 | 4 | 172.16.32.10 puppet.<%= @domain %> puppet 5 | 172.16.32.11 client1.<%= @domain %> client1 6 | 172.16.32.12 client2.<%= @domain %> client2 7 | 8 | # The following lines are desirable for IPv6 capable hosts 9 | # ::1 localhost ip6-localhost ip6-loopback 10 | # fe00::0 ip6-localnet 11 | # ff00::0 ip6-mcastprefix 12 | # ff02::1 ip6-allnodes 13 | # ff02::2 ip6-allrouters 14 | -------------------------------------------------------------------------------- /provision/modules/puppet/files/nodes.pp: -------------------------------------------------------------------------------- 1 | # 2 | # nodes.pp - defines all puppet nodes 3 | # 4 | 5 | # self-manage the puppet master server 6 | node 'puppet' { } 7 | 8 | ##### CLIENTS 9 | 10 | node 'client1' { 11 | class { 'helloworld': } 12 | } 13 | 14 | node 'client2' { } 15 | -------------------------------------------------------------------------------- /provision/modules/puppet/files/puppet.conf: -------------------------------------------------------------------------------- 1 | [main] 2 | # The Puppet log directory. 3 | # The default value is '$vardir/log'. 4 | logdir = /var/log/puppet 5 | 6 | # Where Puppet PID files are kept. 7 | # The default value is '$vardir/run'. 8 | rundir = /var/run/puppet 9 | 10 | # Where SSL certificates are kept. 11 | # The default value is '$confdir/ssl'. 12 | ssldir = $vardir/ssl 13 | 14 | # The search path for modules. 15 | # The default value is '$confdir/modules:/usr/share/puppet/modules'. 16 | basemodulepath = '$confdir/modules:/usr/share/puppet/modules:/vagrant/modules' 17 | 18 | [agent] 19 | # The file in which puppetd stores a list of the classes 20 | # associated with the retrieved configuratiion. Can be loaded in 21 | # the separate ``puppet`` executable using the ``--loadclasses`` 22 | # option. 23 | # The default value is '$confdir/classes.txt'. 24 | classfile = $vardir/classes.txt 25 | 26 | # Where puppetd caches the local configuration. An 27 | # extension indicating the cache format is added automatically. 28 | # The default value is '$confdir/localconfig'. 29 | localconfig = $vardir/localconfig 30 | -------------------------------------------------------------------------------- /provision/modules/puppet/files/site.pp: -------------------------------------------------------------------------------- 1 | # 2 | # site.pp - defines all global defaults 3 | # 4 | 5 | import 'nodes' 6 | -------------------------------------------------------------------------------- /provision/modules/puppet/manifests/apt_pin.pp: -------------------------------------------------------------------------------- 1 | # == Class: puppet::apt_pin 2 | # 3 | # This class pins the Puppet packages so installing specific versions will work 4 | # on Debian-based hosts. 5 | # 6 | # === Parameters 7 | # 8 | # [*version*] 9 | # Which version of the Puppet packages to pin. Required. 10 | # 11 | # === Actions 12 | # 13 | # - Pin the version of the Puppet packages via Apt 14 | # 15 | # === Requires 16 | # 17 | # === Sample Usage 18 | # 19 | # class { 'puppet::apt_pin': 20 | # version => '3.1.0-1puppetlabs1', 21 | # } 22 | # 23 | class puppet::apt_pin( 24 | $version 25 | ) { 26 | 27 | file { 'puppet.pref': 28 | path => '/etc/apt/preferences.d/puppet.pref', 29 | owner => 'root', 30 | group => 'root', 31 | mode => '0644', 32 | content => template('puppet/puppet_apt_pin.pref.erb') 33 | } 34 | 35 | # ensure the pinning file exists before packages are installed 36 | Class['puppet::apt_pin'] -> Package['puppet'] 37 | if defined(Package['puppetmaster']) { 38 | Class['puppet::apt_pin'] -> Package['puppetmaster'] 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /provision/modules/puppet/manifests/init.pp: -------------------------------------------------------------------------------- 1 | # == Class: puppet 2 | # 3 | # This class installs and manages the Puppet client daemon. 4 | # 5 | # === Parameters 6 | # 7 | # [*ensure*] 8 | # What state the package should be in. Defaults to +latest+. Valid values are 9 | # +present+ (also called +installed+), +absent+, +purged+, +held+, +latest+, 10 | # or a specific version number. 11 | # 12 | # === Actions 13 | # 14 | # - Install Puppet client package 15 | # - Ensure puppet-agent daemon is running 16 | # 17 | # === Requires 18 | # 19 | # === Sample Usage 20 | # 21 | # class { 'puppet': } 22 | # 23 | # class { 'puppet': 24 | # ensure => '2.6.8-0.5.el5', 25 | # } 26 | # 27 | class puppet( 28 | $ensure = $puppet::params::client_ensure 29 | ) inherits puppet::params { 30 | 31 | if $osfamily == 'debian' and $ensure != 'latest' { 32 | class { 'puppet::apt_pin': 33 | version => $ensure 34 | } 35 | } 36 | 37 | package { 'puppet': 38 | ensure => $ensure, 39 | } 40 | 41 | # required to start client agent on ubuntu 42 | exec { 'start_puppet': 43 | command => '/bin/sed -i /etc/default/puppet -e "s/START=no/START=yes/"', 44 | onlyif => '/usr/bin/test -f /etc/default/puppet', 45 | require => Package[ 'puppet' ], 46 | before => Service[ 'puppet' ], 47 | } 48 | 49 | # templatedir is deprecated 50 | exec { 'remove_templatedir_setting': 51 | command => '/bin/sed -i /etc/puppet/puppet.conf -e "/templatedir=/d"', 52 | onlyif => '/bin/grep templatedir /etc/puppet/puppet.conf', 53 | require => Package[ 'puppet' ], 54 | before => Service[ 'puppet' ], 55 | } 56 | 57 | service { 'puppet': 58 | enable => true, 59 | ensure => running, 60 | require => Package[ 'puppet' ], 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /provision/modules/puppet/manifests/params.pp: -------------------------------------------------------------------------------- 1 | # == Class: puppet::params 2 | # 3 | # This class manages the Puppet parameters. 4 | # 5 | # === Parameters 6 | # 7 | # === Actions 8 | # 9 | # === Requires 10 | # 11 | # === Sample Usage 12 | # 13 | # This class file is not called directly. 14 | # 15 | class puppet::params { 16 | 17 | $client_ensure = 'latest' 18 | $server_ensure = 'latest' 19 | 20 | case $::osfamily { 21 | 'redhat': { 22 | $server_package_name = 'puppet-server' 23 | } 24 | 'debian': { 25 | $server_package_name = 'puppetmaster' 26 | } 27 | default: { 28 | fail("Module 'puppet' is not currently supported by Puppet Sandbox on ${::operatingsystem}") 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /provision/modules/puppet/manifests/server.pp: -------------------------------------------------------------------------------- 1 | # == Class: puppet::server 2 | # 3 | # This class installs and manages the Puppet server daemon. 4 | # 5 | # === Parameters 6 | # 7 | # [*ensure*] 8 | # What state the package should be in. Defaults to +latest+. Valid values are 9 | # +present+ (also called +installed+), +absent+, +purged+, +held+, +latest+, 10 | # or a specific version number. 11 | # 12 | # [*package_name*] 13 | # The name of the package on the relevant distribution. Default is set by 14 | # Class['puppet::params']. 15 | # 16 | # === Actions 17 | # 18 | # - Install Puppet server package 19 | # - Install puppet-lint gem 20 | # - Configure Puppet to autosign puppet client certificate requests 21 | # - Configure Puppet to use nodes.pp and modules from /vagrant directory 22 | # - Ensure puppet-master daemon is running 23 | # 24 | # === Requires 25 | # 26 | # === Sample Usage 27 | # 28 | # class { 'puppet::server': } 29 | # 30 | # class { 'puppet::server': 31 | # ensure => 'puppet-2.7.17-1.el6', 32 | # } 33 | # 34 | class puppet::server( 35 | $ensure = $puppet::params::server_ensure, 36 | $package_name = $puppet::params::server_package_name 37 | ) inherits puppet::params { 38 | 39 | # required to prevent syslog error on ubuntu 40 | # https://bugs.launchpad.net/ubuntu/+source/puppet/+bug/564861 41 | file { [ '/etc/puppet', '/etc/puppet/files' ]: 42 | ensure => directory, 43 | before => Package[ 'puppetmaster' ], 44 | } 45 | 46 | package { 'puppetmaster': 47 | ensure => $ensure, 48 | name => $package_name, 49 | } 50 | 51 | package { 'puppet-lint': 52 | ensure => latest, 53 | provider => gem, 54 | } 55 | 56 | file { 'puppet.conf': 57 | path => '/etc/puppet/puppet.conf', 58 | owner => 'puppet', 59 | group => 'puppet', 60 | mode => '0644', 61 | source => 'puppet:///modules/puppet/puppet.conf', 62 | require => Package[ 'puppetmaster' ], 63 | notify => Service[ 'puppetmaster' ], 64 | } 65 | 66 | file { 'site.pp': 67 | path => '/etc/puppet/manifests/site.pp', 68 | owner => 'puppet', 69 | group => 'puppet', 70 | mode => '0644', 71 | source => 'puppet:///modules/puppet/site.pp', 72 | require => Package[ 'puppetmaster' ], 73 | } 74 | 75 | file { 'autosign.conf': 76 | path => '/etc/puppet/autosign.conf', 77 | owner => 'puppet', 78 | group => 'puppet', 79 | mode => '0644', 80 | content => '*', 81 | require => Package[ 'puppetmaster' ], 82 | } 83 | 84 | file { '/etc/puppet/manifests/nodes.pp': 85 | ensure => link, 86 | target => '/vagrant/nodes.pp', 87 | require => Package[ 'puppetmaster' ], 88 | } 89 | 90 | # initialize a template file then ignore 91 | file { '/vagrant/nodes.pp': 92 | ensure => present, 93 | replace => false, 94 | source => 'puppet:///modules/puppet/nodes.pp', 95 | } 96 | 97 | service { 'puppetmaster': 98 | enable => true, 99 | ensure => running, 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /provision/modules/puppet/templates/puppet_apt_pin.pref.erb: -------------------------------------------------------------------------------- 1 | # puppet packages 2 | Explanation: pin puppet packages to desired version 3 | Package: puppet puppet-common puppetmaster puppetmaster-common 4 | Pin: version <%= version %> 5 | Pin-Priority: 1000 6 | -------------------------------------------------------------------------------- /provision/modules/repos/manifests/apt.pp: -------------------------------------------------------------------------------- 1 | # == Class: repos::apt 2 | # 3 | # This class installs the Puppet Labs APT repository. 4 | # 5 | # === Parameters 6 | # 7 | # === Actions 8 | # 9 | # - Install puppetlabs repository 10 | # - Perform initial sync to update package database 11 | # 12 | # === Requires 13 | # 14 | # === Sample Usage 15 | # 16 | # class { 'repos::apt': } 17 | # 18 | class repos::apt { 19 | 20 | $puppetlabs_key = '4BD6EC30' 21 | 22 | exec { 'apt_key_puppetlabs': 23 | path => '/bin:/usr/bin', 24 | unless => "/usr/bin/apt-key list | /bin/grep -q '${puppetlabs_key}'", 25 | command => "apt-key adv --keyserver 'keyserver.ubuntu.com' --recv-keys '${puppetlabs_key}'", 26 | before => File[ 'puppetlabs.list' ], 27 | } 28 | 29 | file { 'puppetlabs.list': 30 | ensure => present, 31 | path => '/etc/apt/sources.list.d/puppetlabs.list', 32 | owner => root, 33 | group => root, 34 | mode => '0644', 35 | content => template('repos/puppetlabs.list.erb'), 36 | } 37 | 38 | exec { 'apt_update': 39 | command => '/usr/bin/apt-get update', 40 | subscribe => File[ 'puppetlabs.list' ], 41 | refreshonly => true, 42 | timeout => 0, 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /provision/modules/repos/manifests/init.pp: -------------------------------------------------------------------------------- 1 | # == Class: repos 2 | # 3 | # This class loads the relevant distribution-specific package repository 4 | # manifests and would be the place to configure any other custom repos you 5 | # may want. 6 | # 7 | # === Parameters 8 | # 9 | # === Actions 10 | # 11 | # === Requires 12 | # 13 | # === Sample Usage 14 | # 15 | # class { 'repos': } 16 | # 17 | class repos { 18 | 19 | case $::osfamily { 20 | 'redhat': { 21 | class { 'repos::yum': } 22 | } 23 | 'debian': { 24 | class { 'repos::apt': } 25 | } 26 | default: { 27 | fail("Module '${module_name}' is not currently supported by Puppet Sandbox on ${::operatingsystem}") 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /provision/modules/repos/manifests/yum.pp: -------------------------------------------------------------------------------- 1 | # == Class: repos::yum 2 | # 3 | # This class installs the Puppet Labs YUM repository. 4 | # 5 | # === Parameters 6 | # 7 | # === Actions 8 | # 9 | # - Install puppetlabs repository 10 | # - Perform initial sync to update package database 11 | # 12 | # === Requires 13 | # 14 | # === Sample Usage 15 | # 16 | # class { 'repos::yum': } 17 | # 18 | class repos::yum { 19 | 20 | # can't rely on $lsbmajdistrelease being available on CentOS, and lsb's 21 | # dependencies are huge, so don't force installation of the package 22 | $os_release_major_version = regsubst($operatingsystemrelease, '^(\d+).*$', '\1') 23 | 24 | file { 'puppetlabs.repo': 25 | ensure => present, 26 | path => '/etc/yum.repos.d/puppetlabs.repo', 27 | owner => root, 28 | group => root, 29 | mode => '0644', 30 | content => template('repos/puppetlabs.repo.erb'), 31 | } 32 | 33 | exec { 'yum_makecache': 34 | command => '/usr/bin/yum makecache', 35 | subscribe => File[ 'puppetlabs.repo' ], 36 | refreshonly => true, 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /provision/modules/repos/templates/puppetlabs.list.erb: -------------------------------------------------------------------------------- 1 | # Puppetlabs products 2 | deb http://apt.puppetlabs.com <%= @lsbdistcodename %> PC1 3 | deb-src http://apt.puppetlabs.com <%= @lsbdistcodename %> PC1 4 | 5 | # Puppetlabs dependencies 6 | deb http://apt.puppetlabs.com <%= @lsbdistcodename %> dependencies 7 | deb-src http://apt.puppetlabs.com <%= @lsbdistcodename %> dependencies 8 | 9 | # Puppetlabs devel (uncomment to activate) 10 | # deb http://apt.puppetlabs.com <%= @lsbdistcodename %> devel 11 | # deb-src http://apt.puppetlabs.com <%= @lsbdistcodename %> devel 12 | -------------------------------------------------------------------------------- /provision/modules/repos/templates/puppetlabs.repo.erb: -------------------------------------------------------------------------------- 1 | [puppetlabs-products] 2 | name=Puppet Labs Products <%= os_release_major_version %> - $basearch 3 | baseurl=http://yum.puppetlabs.com/el/<%= os_release_major_version %>/products/$basearch 4 | gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs 5 | enabled=1 6 | gpgcheck=1 7 | 8 | [puppetlabs-deps] 9 | name=Puppet Labs Dependencies <%= os_release_major_version %> - $basearch 10 | baseurl=http://yum.puppetlabs.com/el/<%= os_release_major_version %>/dependencies/$basearch 11 | gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs 12 | enabled=1 13 | gpgcheck=1 14 | -------------------------------------------------------------------------------- /provision/modules/vagrant/manifests/init.pp: -------------------------------------------------------------------------------- 1 | # == Class: vagrant 2 | # 3 | # This class is the place to fix minor Vagrant environment issues that may crop 4 | # up with different base boxes. 5 | # 6 | # === Parameters 7 | # 8 | # === Actions 9 | # 10 | # - Ensure puppet group exists in order to eliminate the following problem: 11 | # https://github.com/camptocamp/puppet-java/issues/4 12 | # 13 | # === Requires 14 | # 15 | # === Sample Usage 16 | # 17 | # class { 'vagrant': } 18 | # 19 | class vagrant { 20 | 21 | group { 'puppet': 22 | ensure => present, 23 | } 24 | 25 | } 26 | --------------------------------------------------------------------------------