|
1 | 1 | #!/bin/bash |
2 | | -yum install epel-release -y |
3 | | -yum install http://yum.puppetlabs.com/puppet6/puppet6-release-el-8.noarch.rpm -y |
4 | | -yum install puppet-agent -y |
5 | | -/opt/puppetlabs/bin/puppet module install puppetlabs-apache |
6 | | -/opt/puppetlabs/bin/puppet module install puppetlabs-mysql |
7 | | -/opt/puppetlabs/bin/puppet module install icinga-icinga2 |
8 | | -/opt/puppetlabs/bin/puppet module install icinga-icingaweb2 |
9 | | -/opt/puppetlabs/bin/puppet apply -v monitoring.localdomain.pp |
| 2 | +wget -O - https://packages.netways.de/netways-repo.asc | sudo apt-key add - |
| 3 | +echo "deb https://packages.netways.de/extras/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/netways-extras-release.list |
| 4 | +wget -O - https://apt.puppetlabs.com/DEB-GPG-KEY-puppet-20250406 | sudo apt-key add - |
| 5 | +echo "deb http://apt.puppetlabs.com jammy puppet7" | sudo tee /etc/apt/sources.list.d/puppet7.list |
| 6 | +apt update |
| 7 | +apt install -y icinga-installer |
| 8 | + |
| 9 | +echo '10.0.0.1 host.localdomain |
| 10 | +10.0.0.2 foreman.localdomain |
| 11 | +10.0.0.3 monitoring.localdomain' >> /etc/hosts |
| 12 | + |
| 13 | +icinga-installer -S server-db-mysql --initial-admin-username icinga --initial-admin-password icinga |
| 14 | + |
| 15 | +usermod -a -G nagios training |
| 16 | + |
| 17 | +sed -i "s@RewriteBase /icingaweb2/@RewriteBase /icingaweb2/\n\tRewriteCond %{REMOTE_ADDR} ^10\.0\.0\.2\n\tRewriteRule ^(.*)$ - [E=REMOTE_USER:foreman]@" /etc/apache2/conf.d/icingaweb2.conf |
| 18 | +systemctl restart apache2 |
| 19 | + |
| 20 | +echo 'object ApiUser "foreman" { |
| 21 | + password = "foreman" |
| 22 | + permissions = [ "*" ] |
| 23 | +}' >> /etc/icinga2/zones.d/main/api-users.conf |
| 24 | +systemctl restart icinga2 |
| 25 | + |
| 26 | +echo '[External] |
| 27 | +backend = "external"' >> /etc/icingaweb2/authentication.ini |
| 28 | +echo '[Foreman] |
| 29 | +users = "foreman" |
| 30 | +permissions = "module/director, director/api, director/*"' >> /etc/icingaweb2/roles.ini |
| 31 | + |
| 32 | +icingacli director host create foreman_host --object_type template --check_command hostalive |
| 33 | +icingacli director service create ssh-linux --object_type template --check_command ssh |
| 34 | +icingacli director service create ssh --object_type apply --imports ssh-linux --assign_filter "host.vars.osfamily=%22Redhat%22 || host.vars.osfamily=%22Debian%22" |
| 35 | +icingacli director config deploy |
0 commit comments