pulling some stuff from npwalker/control-repo

This commit is contained in:
Nick Walker 2015-08-25 11:47:19 -07:00
parent 1e174e6c60
commit 568978d76f
5 changed files with 62 additions and 0 deletions

28
Puppetfile Normal file
View File

@ -0,0 +1,28 @@
forge "http://forge.puppetlabs.com"
# Modules from the Puppet Forge
# Note the versions are all set to :latest but after you've
# installed you should change them to the exact version you want
mod "puppetlabs/inifile", :latest
mod "puppetlabs/stdlib", :latest
mod "puppetlabs/concat", :latest
#An example of using a specific forge module version instead of latest
#Notice the addition of single quotes
#mod "puppetlabs/inifile", '1.3.0'
# Modules from Github using various references
# Further examples: https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#examples
# update the tag to the most current release when implementing
#mod 'hiera',
# :git => 'https://github.com/hunner/puppet-hiera',
# :tag => '1.3.1'
#mod 'notifyme',
# :git => 'git://github.com/glarizza/puppet-notifyme',
# :ref => '50c01703b2e3e352520a9a2271ea4947fe17a51f'
#mod 'profiles',
# :git => 'git://github.com/glarizza/puppet-profiles',
# :ref => '3611ae4253ff01762f9bda1d93620edf8f9a3b22'

8
environment.conf Normal file
View File

@ -0,0 +1,8 @@
modulepath = modules:site:$basemodulepath
config_version = 'scripts/config_version.sh $environmentpath $environment'
# 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

2
hieradata/common.yaml Normal file
View File

@ -0,0 +1,2 @@
---
message: "This node is using common data"

17
scripts/config_version.rb Executable file
View File

@ -0,0 +1,17 @@
require 'rugged'
environmentpath = ARGV[0]
environment = ARGV[1]
repo = Rugged::Repository.discover(File.join(environmentpath, environment))
head = repo.head
#sha1 hash of the newest commit
head_sha = head.target_id
#the commit message associated the newest commit
commit = repo.lookup(head_sha)
#add something to find the remote url
puts head_sha

7
scripts/config_version.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
if [ -e /opt/puppetlabs/server/pe_version ]
then
/opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/config_version.rb $1 $2
else
/usr/bin/git --git-dir $1/$2/.git rev-parse HEAD
fi