Ubuntu 10.04 LTS with Puppet Agent from Backports PPA

by samuelelliot
43 deployments · 5 still active · last rev. 2 years ago

Setup a Linode as a Puppet Agent with a remote Puppet Master, optionally installing Augeas 8.

Requires StackScript Bash Library (StackScriptID: 3687)
Requires StackScript Bash Library (StackScriptID: 3691)

Puppet Backports PPA from LaunchPad ~mathiaz (https://launchpad.net/~mathiaz/+archive/puppet-backports)
Augeas Backports PPA from LaunchPad ~raphink (https://launchpad.net/~raphink/+archive/augeas)

1* [Optional] Starts logging
* Logging is done with synchronous output to the STDOUT
* You can see both stackscript.log & stackscript.err in the root folder
2* Installs "python-software-properties" for "add-apt-repository" to add PPAs into source.list
3* Sets system hostname and timezone
4* Adds repository and key for Puppet backports
5* [Optional] Adds repository and key for Augeas backports
6* Installs "puppet rdoc" and all dependent packages
7* [Optional] Sets Puppet Agent environment
8* [Optional] Adds an IP for puppet in the hosts file
9* [Optional] Run `puppetd --waitforcert 60 --test` for initial handshake.
* An IP address for the Puppet Master must be specified
* Command waits for a signed cert on the CA
* On Puppet Master run `puppetca --list` to view list of unsigned certs
* On Puppet Master run `puppetca --sign fqdn` (where fqdn is your nodes domain) to sign cert

Compatible with: No distros currently supported
						#!/usr/bin/env bash
#
# Ubuntu 10.04 LTS with Puppet Agent from Backports PPA
#
# Setup a Linode as a Puppet Agent with a remote Puppet Master, optionally installing Augeas 8.
#
# Requires StackScript Bash Library (StackScriptID: 3687)
# Requires StackScript Bash Library (StackScriptID: 3691)
#
# Puppet Backports PPA from LaunchPad ~mathiaz (https://launchpad.net/~mathiaz/+archive/puppet-backports)
# Augeas Backports PPA from LaunchPad ~raphink (https://launchpad.net/~raphink/+archive/augeas)
#
# 1* [Optional] Starts logging
#     * Logging is done with synchronous output to the STDOUT
#     * You can see both stackscript.log & stackscript.err in the root folder
# 2* Installs "python-software-properties" for "add-apt-repository" to add PPAs into source.list
# 3* Sets system hostname and timezone
# 4* Adds repository and key for Puppet backports
# 5* [Optional] Adds repository and key for Augeas backports
# 6* Installs "puppet rdoc" and all dependent packages
# 7* [Optional] Sets Puppet Agent environment
# 8* [Optional] Adds an IP for puppet in the hosts file
# 9* [Optional] Run `puppetd --waitforcert 60 --test` for initial handshake.
#     * An IP address for the Puppet Master must be specified
#     * Command waits for a signed cert on the CA
#     * On Puppet Master run `puppetca --list` to view list of unsigned certs
#     * On Puppet Master run `puppetca --sign fqdn` (where fqdn is your nodes domain) to sign cert
#
# <UDF name="sys_hostname"     Label="Hostname"                                example="Ex: test.example.com" />
# <UDF name="sys_timezone"     Label="Timezone"                                example="Ex: America/Los_Angeles, US/Central, EST, etc." />
# <UDF name="puppetagent_env"  Label="Puppet Agent Environment"                example="Ex: development, production, etc." default="" />
# <UDF name="puppetmaster_ip"  Label="Puppet Master IP"                        example="Ex: 12.34.56.78 (* Required to initialize Puppet Secure Communications)" default="" />
# <UDF name="puppet_seccom"    Label="Initialize Puppet Secure Communications" example="(* Requires Puppet Master IP) Runs `puppetd --waitforcert 60 --test` to create a new SSL key and a request for cert on the Puppet Master.  On the Puppet Master run `puppetca --list` to see pending requests and `puppetca --sign fqdn` where fqdn is the hostname for this agent." oneOf="Yes,No" default="No"/>
# <UDF name="install_augeas_8" Label="Install Augeas 8"                        example="Augeas 7 installs by default" oneOf="No,Yes" default="Yes" />
# <UDF name="stackscriptslog"  Label="Log StackScripts Activity"               example="Log output & any errors to roots home. Output is still sent to STDOUT and may be watched from LISH" oneOf="No,Yes" default="Yes" />

source <ssinclude StackScriptID="3687">
source <ssinclude StackScriptID="3691">


######################
## STACKSCRIPT FLOW ##
######################

# Error Logging
if [ "$STACKSCRIPTSLOG" == "Yes" ]; then
    stackscript_log                                     # Defined in StackScriptID 3687
fi

# Bring system up to date
apt_upgrade_full                                        # Defined in StackScriptID 3687

# Set system hostname & timezone
set_hostname "$SYS_HOSTNAME"                            # Defined in StackScriptID 3687
set_timezone "$SYS_TIMEZONE"                            # Defined in StackScriptID 3687


# Add Augeas Backport PPA & Install software
if [ "$INSTALL_AUGEAS_8" == "Yes" ]; then
    augeas_install_from_backports_ppa                   # Defined in StackScriptID 3691
fi

# Add Puppet Backport PPA & Install software
puppet_install_from_backports_ppa                       # Defined in StackScriptID 3691


# Set Agents environment
if [ -n "$PUPPETAGENT_ENV" ]; then
    puppet_config_agent_env "$PUPPETAGENT_ENV"          # Defined in StackScriptID 3691
fi

# Set IP for Puppetmaster
if [ -n "$PUPPETMASTER_IP" ]; then
    puppet_config_agent_master_dns "$PUPPETMASTER_IP"   # Defined in StackScriptID 3691
fi

# Configure CSR
if [ -n "$PUPPETMASTER_IP" -a "$PUPPET_SECCOM" == "Yes" ]; then
    puppet_config_agent_seccom                          # Defined in StackScriptID 3691
fi