Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebirth #2

Merged
merged 4 commits into from
May 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Default .gitignore for Ruby
*.gem
*.rbc
.bundle
.config
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp

# YARD artifacts
.yardoc
_yardoc
doc/

# Vim
*.swp

# OS X
.DS_Store

# Puppet
metadata.json
coverage/
spec/fixtures/modules/*
2 changes: 0 additions & 2 deletions CHANGELOG

This file was deleted.

13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (C) 2010-2013 Garrett Honeycutt <code@garretthoneycutt.com>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
21 changes: 12 additions & 9 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name 'ghoneycutt-puppet'
version '1.0.1'

dependency 'ghoneycutt/apache', '>= 1.0.0'
dependency 'ghoneycutt/facter', '>= 1.0.0'
dependency 'ghoneycutt/generic', '>= 1.0.0'
dependency 'ghoneycutt/pam', '>= 1.0.0'
dependency 'ghoneycutt/sites', '>= 1.0.0'
dependency 'ghoneycutt/ssh', '>= 1.0.0'
dependency 'ghoneycutt/svn', '>= 1.0.0'
version '2.0.0'
source 'git://github.com/ghoneycutt/puppet-module-puppet.git'
author 'ghoneycutt'
license 'Apache License, Version 2.0'
summary 'Manage Puppet'
description 'Manages Puppet, including Master, Agent, Dashboard and maintenance tasks.'
project_page 'https://github.com/ghoneycutt/puppet-module-puppet'

dependency 'puppetlabs/stdlib', '>= 3.2.x'
dependency 'puppetlabs/mysql', '>= 0.6.1'
dependency 'puppetlabs/passenger', '>= 0.0.4'
dependency 'puppetlabs/apache', '>= 0.5.0'
dependency 'puppetlabs/firewall', '>= 0.2.1'
18 changes: 0 additions & 18 deletions README

This file was deleted.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# puppet-module-puppet #
========================

Manages Puppet

Supports:

* Master (Apache with Passenger)
* Agent
* Dashboard (with MySQL)
* Maintenance

# Compatibility #

osfamily redhat specific
3 changes: 3 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
39 changes: 39 additions & 0 deletions files/config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This file is being maintained by Puppet.
# DO NOT EDIT

# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.

# if puppet is not in your RUBYLIB:
# $LOAD_PATH.unshift('/opt/puppet/lib')

$0 = "master"

# if you want debugging:
# ARGV << "--debug"

ARGV << "--rack"

# Rack applications typically don't start as root. Set --confdir and --vardir
# to prevent reading configuration from ~puppet/.puppet/puppet.conf and writing
# to ~puppet/.puppet
ARGV << "--confdir" << "/etc/puppet"
ARGV << "--vardir" << "/var/lib/puppet"

# NOTE: it's unfortunate that we have to use the "CommandLine" class
# here to launch the app, but it contains some initialization logic
# (such as triggering the parsing of the config file) that is very
# important. We should do something less nasty here when we've
# gotten our API and settings initialization logic cleaned up.
#
# Also note that the "$0 = master" line up near the top here is
# the magic that allows the CommandLine class to know that it's
# supposed to be running master.
#
# --cprice 2012-05-22

require 'puppet/util/command_line'
# we're usually running inside a Rack::Builder.new {} block,
# therefore we need to call run *here*.
run Puppet::Util::CommandLine.new.execute

22 changes: 0 additions & 22 deletions files/fileserver.conf

This file was deleted.

33 changes: 0 additions & 33 deletions files/gencert.php

This file was deleted.

43 changes: 0 additions & 43 deletions lib/puppet/parser/functions/get_branch.rb

This file was deleted.

132 changes: 132 additions & 0 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# == Class: puppet::agent
#
# Manage Puppet agents
#
# We also run puppet once at boot via cron, regardless of if you normally run
# puppet from cron or as a daemon.
#
class puppet::agent (
$certname = $::fqdn,
$config_path = '/etc/puppet/puppet.conf',
$config_owner = 'root',
$config_group = 'root',
$config_mode = '0644',
$env = $::env,
$puppet_server = 'puppet',
$puppet_ca_server = 'UNSET',
$is_puppet_master = 'false',
$run_method = 'service',
$run_interval = '30',
$run_in_noop = 'false',
$cron_command = '/usr/bin/puppet agent --onetime --ignorecache --no-daemonize --no-usecacheonfailure --detailed-exitcodes --no-splay',
$run_at_boot = 'true',
$agent_sysconfig = '/etc/sysconfig/puppet',
$daemon_name = 'puppet',
) {

# env must be set, else fail, since we use it in the puppet_config template
if ! $env {
fail('puppet::agent::env must be set')
}

case $is_puppet_master {
'true': {
$config_content = undef
}
'false': {
$config_content = template('puppet/puppetagent.conf.erb')
}
default: {
fail("puppet::agent::is_puppet_master must be 'true' or 'false' and is ${is_puppet_master}")
}
}

case $run_method {
'service': {
$daemon_ensure = 'running'
$daemon_enable = true
$cron_ensure = 'absent'
$my_cron_command = undef
$cron_user = undef
$cron_hour = undef
$cron_minute = undef
}
'cron': {
$daemon_ensure = 'stopped'
$daemon_enable = false
$cron_run_one = fqdn_rand($run_interval)
$cron_run_two = fqdn_rand($run_interval) + 30
$cron_ensure = 'present'
case $run_in_noop {
'true': {
$my_cron_command = '/usr/bin/puppet agent --onetime --ignorecache --no-daemonize --no-usecacheonfailure --detailed-exitcodes --no-splay --noop'
}
'false': {
$my_cron_command = $cron_command
}
default: {
fail("run_in_noop is ${run_in_noop} must be 'true' or 'false'.")
}
}
$cron_user = 'root'
$cron_hour = '*'
$cron_minute = [$cron_run_one, $cron_run_two]
}
default: {
fail("puppet::agent::run_method is ${run_method} and must be 'service' or 'cron'.")
}
}

case $run_at_boot {
'true': {
$at_boot_ensure = 'present'
}
'false': {
$at_boot_ensure = 'absent'
}
default: {
fail("puppet::agent::run_at_boot is ${run_at_boot} and must be 'true' or 'false'.")
}
}

file { 'puppet_config':
path => $config_path,
content => $config_content,
owner => $config_owner,
group => $config_group,
mode => $config_mode,
}

file { 'puppet_agent_sysconfig':
ensure => file,
path => $agent_sysconfig,
content => template('puppet/agent_sysconfig.erb'),
owner => 'root',
group => 'root',
mode => '0644',
}

service { 'puppet_agent_daemon':
# GH: This service will always show as being running while an agent run is
# taking place, so we no longer ensure its status. Before doing this, there
# would *always* be a logged change and the Console could never be green.
#ensure => $daemon_ensure,
name => $daemon_name,
enable => $daemon_enable,
}

cron { 'puppet_agent':
ensure => $cron_ensure,
command => $my_cron_command,
user => $cron_user,
hour => $cron_hour,
minute => $cron_minute,
}

cron { 'puppet_agent_once_at_boot':
ensure => $at_boot_ensure,
command => $my_cron_command,
user => $cron_user,
special => 'reboot',
}
}
Loading