From 4e2a2b81cf17909647728a0c9febab7ab0370e65 Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Tue, 13 Jan 2015 16:42:06 -0800 Subject: [PATCH] Initial Commit Stole Gary's puppet_repository and modified it for general general consumption. Upped the version of r10k to newest (1.4.1) Ripped out the hiera examples just left defaults.yaml Tweaked environment.conf --- Puppetfile | 16 +++++++++++++++ configure_r10k.pp | 21 ++++++++++++++++++++ environment.conf | 8 ++++++++ hiera.yaml | 14 +++++++++++++ hieradata/defaults.yaml | 2 ++ manifests/site.pp | 44 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 105 insertions(+) create mode 100644 Puppetfile create mode 100644 configure_r10k.pp create mode 100644 environment.conf create mode 100644 hiera.yaml create mode 100644 hieradata/defaults.yaml create mode 100644 manifests/site.pp diff --git a/Puppetfile b/Puppetfile new file mode 100644 index 0000000..77f1ccb --- /dev/null +++ b/Puppetfile @@ -0,0 +1,16 @@ +forge "http://forge.puppetlabs.com" + +# Modules from the Puppet Forge +mod "puppetlabs/apache" +mod "puppetlabs/ntp" + +# Modules from Github using various references +# Further examples: https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#examples +mod 'notifyme', + :git => 'git://github.com/glarizza/puppet-notifyme', + :ref => '50c01703b2e3e352520a9a2271ea4947fe17a51f' + +mod 'profiles', + :git => 'git://github.com/glarizza/puppet-profiles', + :ref => '3611ae4253ff01762f9bda1d93620edf8f9a3b22' + diff --git a/configure_r10k.pp b/configure_r10k.pp new file mode 100644 index 0000000..1965a43 --- /dev/null +++ b/configure_r10k.pp @@ -0,0 +1,21 @@ +###### ###### +## Configure R10k ## +###### ###### + +## This manifest requires the zack/R10k module and will attempt to +## configure R10k according to my blog post on directory environments. +## Beware! (and good luck!) + +class { 'r10k': + version => '1.4.1', + sources => { + 'puppet' => { + #Edit remote to be your own control_repo + 'remote' => 'https://github.com/npwalker/control_repo.git', + 'basedir' => "${::settings::confdir}/environments", + 'prefix' => false, + } + }, + purgedirs => ["${::settings::confdir}/environments"], + manage_modulepath => false, +} diff --git a/environment.conf b/environment.conf new file mode 100644 index 0000000..6511fe4 --- /dev/null +++ b/environment.conf @@ -0,0 +1,8 @@ +modulepath = modules:$basemodulepath +config_version = '/usr/bin/git --git-dir $confdir/environments/$environment/.git rev-parse HEAD' + +# Environment timeout should be set to unlimited. When set to zero it is less performant. +# When code is deployed the admin API of puppetserver should be used to force a refresh of code from disk. +# https://docs.puppetlabs.com/puppetserver/1.0/release_notes.html#new-feature-admin-api-for-refreshing-environments +# https://docs.puppetlabs.com/puppet/3.7/reference/environments_configuring.html#environmenttimeout +environment_timeout = 0 diff --git a/hiera.yaml b/hiera.yaml new file mode 100644 index 0000000..1ce9330 --- /dev/null +++ b/hiera.yaml @@ -0,0 +1,14 @@ +--- +:backends: + - yaml +:hierarchy: + - "%{clientcert}" + - "%{application_tier}" + - defaults + +:yaml: +# datadir is empty here, so hiera uses its defaults: +# - /var/lib/hiera on *nix +# - %CommonAppData%\PuppetLabs\hiera\var on Windows +# When specifying a datadir, make sure the directory exists. + :datadir: "/etc/puppetlabs/puppet/environments/%{environment}/hieradata" diff --git a/hieradata/defaults.yaml b/hieradata/defaults.yaml new file mode 100644 index 0000000..2baa62b --- /dev/null +++ b/hieradata/defaults.yaml @@ -0,0 +1,2 @@ +--- +message: "This node is using common data" diff --git a/manifests/site.pp b/manifests/site.pp new file mode 100644 index 0000000..d52e944 --- /dev/null +++ b/manifests/site.pp @@ -0,0 +1,44 @@ + +## site.pp ## + +# This file (/etc/puppetlabs/puppet/manifests/site.pp) is the main entry point +# used when an agent connects to a master and asks for an updated configuration. +# +# Global objects like filebuckets and resource defaults should go in this file, +# as should the default node definition. (The default node can be omitted +# if you use the console and don't define any other nodes in site.pp. See +# http://docs.puppetlabs.com/guides/language_guide.html#nodes for more on +# node definitions.) + +## Active Configurations ## + +# PRIMARY FILEBUCKET +# This configures puppet agent and puppet inspect to back up file contents when +# they run. The Puppet Enterprise console needs this to display file contents +# and differences. + +# Define filebucket 'main': +filebucket { 'main': + #server should point to one master that will be the file bucket + server => 'changeme', + path => false, +} + +# Make filebucket 'main' the default backup location for all File resources: +File { backup => 'main' } + +# DEFAULT NODE +# Node definitions in this file are merged with node data from the console. See +# http://docs.puppetlabs.com/guides/language_guide.html#nodes for more on +# node definitions. + +# The default node definition matches any node lacking a more specific node +# definition. If there are no other nodes in this file, classes declared here +# will be included in every node's catalog, *in addition* to any classes +# specified in the console for that node. + +node default { + # This is where you can declare classes for all nodes. + # Example: + # class { 'my_class': } +}