forked from MiamiOH/puppet-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.sh
executable file
·32 lines (28 loc) · 970 Bytes
/
service.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
#!/usr/bin/env bash
#
# Start the Puppet Service or Cron
#
set -e
PUPPET_SERVICE=${PUPPET_SERVICE:-"puppet" # "com.puppetlabs.puppet"}
case "${PUPPET_ENVIRONMENT}" in
development)
PUPPET_CRON_NAM=${PUPPET_CRON_NAM:-"puppet-apply"}
PUPPET_CRON_CMD=${PUPPET_CRON_CMD:-"/usr/bin/puppet apply --parser future /etc/puppet/manifests"}
;;
*)
PUPPET_CRON_NAM=${PUPPET_CRON_NAM:-"puppet-agent"}
PUPPET_CRON_CMD=${PUPPET_CRON_CMD:-"/usr/bin/puppet agent --onetime --no-daemonize --splay"}
;;
esac
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root." >&2
exit 1
fi
# 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..."
puppet resource cron ${PUPPET_CRON_NAM} ensure=present command="${PUPPET_CRON_CMD}" user=root minute=0
# Force a run to generate ssl sign request
# puppet agent --test || true