-
Notifications
You must be signed in to change notification settings - Fork 1
/
yes_create_a_puppet_development_environment.sh
executable file
·72 lines (61 loc) · 1.89 KB
/
yes_create_a_puppet_development_environment.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
c7='CentOS 7'
d8='Debian 8'
d9='Debian 9'
u12='Ubuntu 1204 LTS'
u14='Ubuntu 1404 LTS'
u16='Ubuntu 1604 LTS'
u18='Ubuntu 1804 LTS'
echo 'Please Enter the Puppetversion you want to use. Type 5 for Puppet5'
#add input validation
read PUPPETVERSION
echo 'Please Enter the OS you want to use on the clientside. Type'
echo 'c7 for CentOS 7'
echo 'd8 for Debian 8'
echo 'd9 for Debian 9'
echo 'u12 for Ubuntu 1204 LTS'
echo 'u14 for Ubuntu 1404 LTS'
echo 'u16 for Ubuntu 1604 LTS'
echo 'u16 for Ubuntu 1804 LTS'
#add input validation
read OS
echo 'Please Enter the number of clients you want to create. possible 1-10'
#add input validation
read NUMBER_OF_PUPPETCLIENTS
echo "deleting existing puppetmaster environment"
vagrant destroy -f
if [ -f Vagrantfile ]; then
rm Vagrantfile
fi
for i in $(ls -1 clients/);
do
echo "deleting all clients in $i"
cd clients/$i
if [ -f Vagrantfile ]; then
vagrant destroy -f
fi
cd ../..
done
if [ "$PUPPETVERSION" == "5" ]; then
echo "I will build a Puppet development environment for Puppet5 with $NUMBER_OF_PUPPETCLIENTS clients on ${!OS}"
cp VagrantfileV5 Vagrantfile
fi
echo "doing first vagrant run"
vagrant up
echo "doing second vagrant run"
vagrant up
echo "doing third vagrant run"
vagrant up
echo "puppet never runs completely trouble less when setting up a multi node puppetdb setup"
if [ "$PUPPETVERSION" == "5" ]; then
vagrant ssh puppet -c 'sudo /opt/puppetlabs/bin/puppet agent -t --server puppet.local'
vagrant ssh puppet -c 'sudo /opt/puppetlabs/bin/puppet agent -t --server puppet.local'
vagrant ssh puppetdb -c 'sudo /opt/puppetlabs/bin/puppet agent -t --server puppet.local'
vagrant ssh postgres-puppetdb -c 'sudo /opt/puppetlabs/bin/puppet agent -t --server puppet.local'
fi
cd clients/"$OS"p"$PUPPETVERSION"
for (( i=1; i<=$NUMBER_OF_PUPPETCLIENTS; i++ ))
do
echo "building puppetclient 0$i with ${!OS}"
vagrant up puppetclient0$i
done