forked from MiamiOH/puppet-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete bootstrap with config and cron
- Loading branch information
Showing
3 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Bootstrap script to install/config/start puppet on multi POSIX platforms | ||
# | ||
set -e | ||
|
||
PLATFORM=${PLATFORM:-$1} | ||
|
||
# Install Puppet Using the Puppet Labs Package Repositories | ||
case "${PLATFORM}" in | ||
redhat_5|centos_5|centos_5_x) | ||
sudo ./centos_5_x.sh | ||
;; | ||
redhat_6|centos_6|centos_6_x) | ||
sudo ./centos_6_x.sh | ||
;; | ||
redhat_7|centos_7|centos_7_x) | ||
sudo ./centos_7_x.sh | ||
;; | ||
ubuntu) | ||
sudo ./ubuntu.sh | ||
;; | ||
osx|mac_os_x) | ||
PUPPET_ROOT_GROUP=${PUPPET_ROOT_GROUP:-"wheel"} | ||
PUPPET_SERVICE=${PUPPET_SERVICE:-"com.puppetlabs.puppet"} | ||
sudo ./mac_os_x.sh | ||
*) | ||
echo "Unknown/Unsupported PLATFORM. Usage: $0 {redhat_5|redhat_6|redhat_7|ubuntu|osx}" >&2 | ||
exit 1 | ||
esac | ||
|
||
# Configure /etc/puppet/puppet.conf | ||
. configure.sh | ||
|
||
# Start the Puppet Agent Service | ||
. service.sh | ||
|
||
echo "Success!!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Configure /etc/puppet/puppet.conf | ||
# | ||
set -e | ||
|
||
PUPPET_SERVER=${PUPPET_SERVER:-"pupt001.projectdragonfly.org"} | ||
PUPPET_ENVIRONMENT=${PUPPET_ENVIRONMENT:-"staging"} | ||
PUPPET_ROOT_GROUP=${PUPPET_ROOT_GROUP:-"root"} | ||
|
||
echo "Configuring Puppet..." | ||
sudo cat > /etc/puppet/puppet.conf <<-EOF | ||
# Deployment puppet.conf config for puppet | ||
# WARNING: this file has been automatically setup by puppet-bootstrap | ||
# Please make changes there and rerun setup, not here, as they will be overwritten.... | ||
# | ||
# http://docs.puppetlabs.com/references/latest/configuration.html | ||
# | ||
[main] | ||
# The Puppet log directory. | ||
# The default value is '\$vardir/log'. | ||
logdir = \$vardir/log | ||
# Where Puppet PID files are kept. | ||
# The default value is '\$vardir/run'. | ||
rundir = \$vardir/run | ||
# Where SSL certificates are kept. | ||
# The default value is '\$confdir/ssl'. | ||
ssldir = \$vardir/ssl | ||
server = ${PUPPET_SERVER} | ||
masterport = 8140 | ||
report = true | ||
pluginsync = true | ||
[agent] | ||
# The file in which puppetd stores a list of the classes | ||
# associated with the retrieved configuratiion. Can be loaded in | ||
# the separate ``puppet`` executable using the ``--loadclasses`` | ||
# option. | ||
# The default value is '\$confdir/classes.txt'. | ||
classfile = \$vardir/classes.txt | ||
# Where puppetd caches the local configuration. An | ||
# extension indicating the cache format is added automatically. | ||
# The default value is '\$confdir/localconfig'. | ||
localconfig = \$vardir/localconfig | ||
environment = ${PUPPET_ENVIRONMENT} | ||
runinterval = 60m | ||
splay = true | ||
splaylimit = 20m | ||
#ignorecache = true | ||
EOF | ||
sudo chown root:${PUPPET_ROOT_GROUP} /etc/puppet/puppet.conf | ||
sudo chmod 0644 /etc/puppet/puppet.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Start the Puppet Agent Service or Cron | ||
# | ||
set -e | ||
|
||
PUPPET_SERVICE=${PUPPET_SERVICE:-"puppet" # "com.puppetlabs.puppet"} | ||
PUPPET_CRON=${PUPPET_CRON:-"/usr/bin/puppet agent --onetime --no-daemonize --splay"} | ||
|
||
# Start the Puppet Agent Service | ||
# echo "Starting Puppet Agent..." | ||
# sudo puppet resource service ${PUPPET_SERVICE} ensure=running enable=true | ||
# Create a Cron Job Instead | ||
echo "Starting Puppet Cron..." | ||
sudo puppet resource cron puppet-agent ensure=present command="${PUPPET_CRON}" user=root minute=0 |