mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 01:17:42 -04:00
Adding things for using Puppet
This commit is contained in:
parent
00e63ca7be
commit
bff34cde83
13 changed files with 86 additions and 8 deletions
|
|
@ -8,19 +8,15 @@ else
|
|||
end
|
||||
|
||||
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 'puppet', puppetversion
|
||||
gem 'puppetlabs_spec_helper', '~> 1.1'
|
||||
gem 'r10k', '~> 2.3'
|
||||
gem 'rspec-puppet', '~> 2.5'
|
||||
gem 'rugged', '~> 0.24'
|
||||
gem 'yamllint', '~> 0.0.9'
|
||||
|
||||
# puppet-lint and plugins
|
||||
|
|
@ -36,4 +32,3 @@ group :development, :unit_tests do
|
|||
gem 'puppet-lint-unquoted_string-check', '~> 0.3'
|
||||
gem 'puppet-lint-variable_contains_upcase', '~> 1.1'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ GEM
|
|||
rspec-puppet (2.5.0)
|
||||
rspec
|
||||
rspec-support (3.6.0)
|
||||
rugged (0.25.1.1)
|
||||
semantic_puppet (0.1.4)
|
||||
gettext-setup (>= 0.3)
|
||||
spdx-licenses (1.1.0)
|
||||
|
|
@ -127,6 +128,7 @@ DEPENDENCIES
|
|||
puppetlabs_spec_helper (~> 1.1)
|
||||
r10k (~> 2.3)
|
||||
rspec-puppet (~> 2.5)
|
||||
rugged (~> 0.24)
|
||||
yamllint (~> 0.0.9)
|
||||
|
||||
BUNDLED WITH
|
||||
|
|
|
|||
2
bin/puppet/environment.conf
Normal file
2
bin/puppet/environment.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
modulepath = modules:site:$basemodulepath
|
||||
config_version = 'scripts/config_version.sh $environmentpath $environment'
|
||||
1
bin/puppet/hieradata/common.yaml
Normal file
1
bin/puppet/hieradata/common.yaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
---
|
||||
1
bin/puppet/hieradata/nodes/example-node.yaml
Normal file
1
bin/puppet/hieradata/nodes/example-node.yaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
---
|
||||
14
bin/puppet/manifests/site.pp
Normal file
14
bin/puppet/manifests/site.pp
Normal 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
2
bin/puppet/r10k.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
cachedir: 'vendor/r10k'
|
||||
10
bin/puppet/scripts/code_manager_config_version.rb
Executable file
10
bin/puppet/scripts/code_manager_config_version.rb
Executable 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']
|
||||
24
bin/puppet/scripts/config_version.rb
Executable file
24
bin/puppet/scripts/config_version.rb
Executable 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
|
||||
12
bin/puppet/scripts/config_version.sh
Executable file
12
bin/puppet/scripts/config_version.sh
Executable 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
|
||||
4
bin/puppet/site/profile/manifests/base.pp
Normal file
4
bin/puppet/site/profile/manifests/base.pp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# the base profile should include component modules that will be on all nodes
|
||||
class profile::base {
|
||||
|
||||
}
|
||||
7
bin/puppet/site/role/manifests/server.pp
Normal file
7
bin/puppet/site/role/manifests/server.pp
Normal 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
|
||||
}
|
||||
4
bin/puppet/site/role/manifests/workstation.pp
Normal file
4
bin/puppet/site/role/manifests/workstation.pp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Includes all the profiles needed for a workstation
|
||||
class role::workstation {
|
||||
include ::profile::base
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue