-
Notifications
You must be signed in to change notification settings - Fork 0
/
puppet-setup
executable file
·66 lines (55 loc) · 1.48 KB
/
puppet-setup
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
#!/usr/bin/env bash
# Author: [email protected]
# Purpose: Quick script to the puppet show
# Supported OS: Ubuntu 16.04 LTS; Ubuntu 18.04 LTS
write_puppet_config() {
cat >/etc/puppetlabs/puppet/puppet.conf <<-EOF
# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://puppet.com/docs/puppet/latest/config_important_settings.html
# - https://puppet.com/docs/puppet/latest/config_about_settings.html
# - https://puppet.com/docs/puppet/latest/config_file_main.html
# - https://puppet.com/docs/puppet/latest/configuration.html
[agent]
pluginsync = true
report = true
ignoreschedules = true
ca_server = pancho-foreman.cichq.com
server = pancho-foreman.cichq.com
certname = `hostname -f`
EOF
}
setup_puppet6() {
wget https://apt.puppetlabs.com/puppet6-release-$1.deb
dpkg -i puppet6-release-$1.deb
apt-get update
apt-get install -y puppet-agent
rm puppet6-release-$1.deb
write_puppet_config
chmod +x /etc/profile.d/puppet-agent.sh
source /etc/profile.d/puppet-agent.sh
puppet agent --test
}
setup_puppet() {
if [ ! -r "/etc/lsb-release" ]; then
echo "Cannot read version" >&2
exit 1
fi
. /etc/lsb-release
case "$DISTRIB_RELEASE" in
"16.04")
setup_puppet6 "xenial"
;;
"18.04")
setup_puppet6 "bionic"
;;
"20.04")
setup_puppet6 "focal"
;;
*)
echo "Unknown version: ${DISTRIB_RELEASE}" >&2
exit 1
;;
esac
}
setup_puppet