]> WPIA git - infra.git/blob - bootstrap
add: motion system from source
[infra.git] / bootstrap
1 #!/bin/bash
2 #sudo apt-get install sudo git
3 #sudo apt-get install emacs-nox tmux
4 #git clone ...
5 if ((UID != 0)); then
6     printf >&2 '%s: must be run as root\n' "$0"
7     exit 1
8 fi
9 . conf-puppet
10
11 if ! [[ -x /usr/bin/puppet ]]; then
12     apt-get update
13     apt-get install -y puppet puppet-master
14 fi
15
16 if ! [[ -h /etc/puppet/code/modules ]]; then
17     ln -s $PWD/modules /etc/puppet/code/modules
18     ln -s $PWD/environments /etc/puppet/code/environments
19 fi
20 if grep -q "^search\|^domain" /etc/resolv.conf; then
21     echo "Removing domain from resolv.conf"
22     sed -i "/^search\|^domain/d" /etc/resolv.conf
23     systemctl restart puppet-master
24 fi
25
26 if ! grep -q host01 /etc/hosts; then
27     echo "Changing hostname"
28     hostnamectl set-hostname host01
29     echo "127.0.0.1 host01" >> /etc/hosts
30     systemctl restart puppet-master
31     echo "Please open a new shell (hostname) and restart bootstrap"
32     exit
33 fi
34
35
36 # In version 4.19 and 4.20, the "file_line" is not able to remove "search" and "domain" lines from the container's resolv.conf.
37 # Since Puppet 4 does not support "union ranges" of versions (only Puppet 5 does, which is currently not included in Debian), require >=4.21.0 and ignore that <=4.18 works as well.
38 # <5 is required for puppetlabs-postgresql v4: https://forge.puppet.com/puppetlabs/postgresql/4.9.0/dependencies
39 # installing a newer stdlib causes postgresql-v4 fail installation.
40 puppet module install puppetlabs-stdlib --version ">=4.21.0 <5.0.0"
41 puppet module install puppetlabs-firewall --version 1
42 puppet module install puppetlabs-apt --version 2
43 puppet module install puppetlabs-postgresql --version 4
44 puppet module install puppetlabs-mysql --version 3
45
46 puppet apply /etc/puppet/code/environments/production/manifests --debug