-
Notifications
You must be signed in to change notification settings - Fork 23
/
bootstrap.sh
executable file
·31 lines (27 loc) · 1.22 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
#!/bin/sh
# Add bootstrap modules
mkdir -p /root/bootstrap/modules
puppet module install --modulepath=/root/bootstrap/modules jlambert121/puppet --version 0.7.0
puppet module install --modulepath=/root/bootstrap/modules zack/r10k --version 3.2.0
puppet module install --modulepath=/root/bootstrap/modules stahnma/epel --version 1.2.2
puppet module install --modulepath=/root/bootstrap/modules hunner/hiera --version 1.4.1
# Configure the master, hiera, and r10k services
puppet apply --modulepath=/root/bootstrap/modules master.pp && \
puppet apply --modulepath=/root/bootstrap/modules hiera.pp && \
puppet apply --modulepath=/root/bootstrap/modules r10k_installation.pp && \
# If everything went well, deploy using r10k
r10k deploy environment -p
# If everything is successful, run puppet, otherwise alert
if [ $? -eq 0 ]
then
# Ensure changes to hiera and the master configuration are in place before continuing
systemctl restart puppetserver
puppet agent -t
systemctl enable puppet
systemctl start puppet
else
echo "Some part of the bootstrap process failed. Investigate the errors and proceed with manual bootstrapping."
echo ""
echo "See https://github.com/puppetinabox/documentation#bootstrap for the steps."
echo ""
fi