Adding things for using Puppet

This commit is contained in:
Gene Liverman 2017-05-06 18:29:40 -07:00
parent 00e63ca7be
commit bff34cde83
13 changed files with 86 additions and 8 deletions

View file

@ -8,19 +8,15 @@ else
end end
group :development, :unit_tests do group :development, :unit_tests do
if RUBY_VERSION < '2.0'
gem 'json', '1.8.3'
gem 'json_pure', '1.8.3'
else
gem 'json', '>= 2.0.2'
gem 'json_pure', '>= 2.0.2'
end
gem 'json', '>= 2.0.2'
gem 'json_pure', '>= 2.0.2'
gem 'metadata-json-lint', '~> 1.0' gem 'metadata-json-lint', '~> 1.0'
gem 'puppet', puppetversion gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '~> 1.1' gem 'puppetlabs_spec_helper', '~> 1.1'
gem 'r10k', '~> 2.3' gem 'r10k', '~> 2.3'
gem 'rspec-puppet', '~> 2.5' gem 'rspec-puppet', '~> 2.5'
gem 'rugged', '~> 0.24'
gem 'yamllint', '~> 0.0.9' gem 'yamllint', '~> 0.0.9'
# puppet-lint and plugins # puppet-lint and plugins
@ -36,4 +32,3 @@ group :development, :unit_tests do
gem 'puppet-lint-unquoted_string-check', '~> 0.3' gem 'puppet-lint-unquoted_string-check', '~> 0.3'
gem 'puppet-lint-variable_contains_upcase', '~> 1.1' gem 'puppet-lint-variable_contains_upcase', '~> 1.1'
end end

View file

@ -97,6 +97,7 @@ GEM
rspec-puppet (2.5.0) rspec-puppet (2.5.0)
rspec rspec
rspec-support (3.6.0) rspec-support (3.6.0)
rugged (0.25.1.1)
semantic_puppet (0.1.4) semantic_puppet (0.1.4)
gettext-setup (>= 0.3) gettext-setup (>= 0.3)
spdx-licenses (1.1.0) spdx-licenses (1.1.0)
@ -127,6 +128,7 @@ DEPENDENCIES
puppetlabs_spec_helper (~> 1.1) puppetlabs_spec_helper (~> 1.1)
r10k (~> 2.3) r10k (~> 2.3)
rspec-puppet (~> 2.5) rspec-puppet (~> 2.5)
rugged (~> 0.24)
yamllint (~> 0.0.9) yamllint (~> 0.0.9)
BUNDLED WITH BUNDLED WITH

View file

@ -0,0 +1,2 @@
modulepath = modules:site:$basemodulepath
config_version = 'scripts/config_version.sh $environmentpath $environment'

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1,14 @@
## site.pp ##
# DEFAULT NODE
# 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 via an ENC for that node.
node default {
# This is where you can declare classes for all nodes.
# Example:
# class { 'my_class': }
}

2
bin/puppet/r10k.yaml Normal file
View file

@ -0,0 +1,2 @@
---
cachedir: 'vendor/r10k'

View file

@ -0,0 +1,10 @@
#!/usr/bin/env ruby
require 'json'
environmentpath = ARGV[0]
environment = ARGV[1]
r10k_deploy_file_path = File.join(environmentpath, environment, '.r10k-deploy.json')
# output the sha1 from the control-repo
puts JSON.parse(File.read(r10k_deploy_file_path))['signature']

View file

@ -0,0 +1,24 @@
#!/usr/bin/env ruby
begin
require 'rugged'
rescue LoadError => e
t = Time.new
puts t.to_i
else
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
end

View file

@ -0,0 +1,12 @@
#!/bin/bash
if [ -e $1/$2/.r10k-deploy.json ]
then
/opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/code_manager_config_version.rb $1 $2
elif [ -e /opt/puppetlabs/server/pe_version ]
then
/opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/config_version.rb $1 $2
else
/usr/bin/git --version > /dev/null 2>&1 &&
/usr/bin/git --git-dir $1/$2/.git rev-parse HEAD ||
date +%s
fi

View file

@ -0,0 +1,4 @@
# the base profile should include component modules that will be on all nodes
class profile::base {
}

View file

@ -0,0 +1,7 @@
# Includes all the profiles needed for a server.
# One big difference between this and the workstation role is that you generally
# are not standing in front of the system and / or there is no graphical
# interface.
class role::workstation {
include ::profile::base
}

View file

@ -0,0 +1,4 @@
# Includes all the profiles needed for a workstation
class role::workstation {
include ::profile::base
}