forked from hashicorp/puppet-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bootstrap.sh
executable file
·53 lines (45 loc) · 1.6 KB
/
bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
#
# Bootstrap script to install/config/start puppet on multi POSIX platforms
#
set -e
BOOTSTRAP_HOME=${BOOTSTRAP_HOME:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}
PLATFORM=${PLATFORM:-$1}
PUPPET_ENVIRONMENT=${PUPPET_ENVIRONMENT:-$2}
PUPPET_COLLECTION=${PUPPET_COLLECTION:-$3}
PUPPET_SERVER=${PUPPET_SERVER:-$4}
PUPPET_CA_SERVER=${PUPPET_CA_SERVER:-$5}
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root." >&2
exit 1
fi
if [ "${PUPPET_ENVIRONMENT}" != "vagrant" ]; then
# Remove any detected legacy puppet installs
source "${BOOTSTRAP_HOME}/legacy.sh"
fi
# Install Puppet Using the Puppet Labs Package Repositories
case "${PLATFORM}" in
redhat_5|centos_5|centos_5_x) source "${BOOTSTRAP_HOME}/centos_5_x.sh" ;;
redhat_6|centos_6|centos_6_x) source "${BOOTSTRAP_HOME}/centos_6_x.sh" ;;
redhat_7|centos_7|centos_7_x) source "${BOOTSTRAP_HOME}/centos_7_x.sh" ;;
redhat_8|centos_8|centos_8_x) source "${BOOTSTRAP_HOME}/oraclelinux_8_x.sh" ;;
debian) source "${BOOTSTRAP_HOME}/debian.sh" ;;
ubuntu) source "${BOOTSTRAP_HOME}/ubuntu.sh" ;;
osx|mac_os_x)
PUPPET_ROOT_GROUP=${PUPPET_ROOT_GROUP:-"wheel"}
source "${BOOTSTRAP_HOME}/mac_os_x.sh"
;;
*)
echo "Unknown/Unsupported PLATFORM." >&2
echo "Usage: $0 {redhat_5|redhat_6|redhat_7|redhat_8|debian|ubuntu|osx} [environment] [server]" >&2
exit 1
esac
# Post Install Cleanup
source "${BOOTSTRAP_HOME}/postinstall.sh"
if [ "${PUPPET_ENVIRONMENT}" != "vagrant" ]; then
# Configure puppet.conf
source "${BOOTSTRAP_HOME}/configure.sh"
# Start the Puppet Service or Cron
source "${BOOTSTRAP_HOME}/service.sh"
fi
echo "Success!!"