Skip to content

Commit f6c8db5

Browse files
committed
updates to latest releases and some small fixes
1 parent c90e851 commit f6c8db5

66 files changed

Lines changed: 1132 additions & 1258 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This training is designed as a two day hands-on training introducing Foreman.
44

5-
In the training you will get basic knowlegde of the architecture of Foreman. You will
5+
In the training you will get basic knowledge of the architecture of Foreman. You will
66
install and configure Foreman to provide several ways of provisioning. The configuration
77
management solution used is Puppet to show configuration management integration into Foreman.
88
Furthermore user and permission management of Foreman is shown. And last but not least
@@ -18,9 +18,9 @@ In addition to the sources you can find the rendered material on
1818
[netways.github.io](https://netways.github.io/foreman-training)
1919

2020
* [Presentation](https://netways.github.io/foreman-training)
21-
* [Handouts](https://github.com/NETWAYS/foreman-training/releases/download/v1.4/foreman-training-handouts.pdf)
22-
* [Exercises](https://github.com/NETWAYS/foreman-training/releases/download/v1.4/foreman-training-exercises.pdf)
23-
* [Solutions](https://github.com/NETWAYS/foreman-training/releases/download/v1.4/foreman-training-solutions.pdf)
21+
* [Handouts](https://github.com/NETWAYS/foreman-training/releases/download/v1.6/foreman-training-handouts.pdf)
22+
* [Exercises](https://github.com/NETWAYS/foreman-training/releases/download/v1.6/foreman-training-exercises.pdf)
23+
* [Solutions](https://github.com/NETWAYS/foreman-training/releases/download/v1.6/foreman-training-solutions.pdf)
2424

2525
## Provide your own training
2626

Setup.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
## Virtual machine foreman.localdomain
44

5-
To setup a new version of the virtual machine install CentOS from ISO, only configuration required is
5+
To setup a new version of the virtual machine install CentOS 8 from ISO, only configuration required is
66
setting the network interface to manual, ip address 10.0.0.2, netmask 255.255.0.0, gateway 10.0.0.1,
77
dns 10.0.0.1.
88

99
Afterwards run the finish.sh provided in the _files directory to setup host entries and openldap.
1010

1111
## Virtual machine monitoring.localdomain
1212

13-
To setup a new version of the virtual machine install CentOS from ISO, only configuration required is
13+
To setup a new version of the virtual machine install CentOS 8 from ISO, only configuration required is
1414
setting the network interface to manual, ip address 10.0.0.3, netmask 255.255.0.0, gateway 10.0.0.1,
1515
dns 10.0.0.1.
1616

@@ -19,8 +19,8 @@ Icinga 2, Icinga Web 2 and Director with preparations for the exercise.
1919

2020
## Local mirror
2121

22-
A Vagrant file is provided in the directory to setup a local mirror of CentOS 7 x86_64, EPEL 7 x86_64
23-
Puppet EPEL 7 x86_64, Foreman EPEL 7 x86_64 and the Discovery Image. This machine will require about
22+
A Vagrant file is provided in the directory to setup a local mirror of CentOS 8 x86_64, EPEL 8 x86_64
23+
Puppet EPEL 8 x86_64, Foreman EPEL 8 x86_64 and the Discovery Image. This machine will require about
2424
25GB.
2525

2626
## Katello Demo

Vagrantfile

Lines changed: 49 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,54 @@
11
# -*- mode: ruby -*-
22
# vi: set ft=ruby :
33

4-
# All Vagrant configuration is done below. The "2" in Vagrant.configure
5-
# configures the configuration version (we support older styles for
6-
# backwards compatibility). Please don't change it unless you know what
7-
# you're doing.
84
Vagrant.configure(2) do |config|
9-
# The most common configuration options are documented and commented below.
10-
# For a complete reference, please see the online documentation at
11-
# https://docs.vagrantup.com.
12-
13-
# Every Vagrant development environment requires a box. You can search for
14-
# boxes at https://atlas.hashicorp.com/search.
15-
config.vm.box = "centos/7"
16-
config.vm.hostname = "mirror"
17-
config.vm.synced_folder ".", "/vagrant", type: "rsync"
18-
19-
# Disable automatic box update checking. If you disable this, then
20-
# boxes will only be checked for updates when the user runs
21-
# `vagrant box outdated`. This is not recommended.
22-
# config.vm.box_check_update = false
23-
24-
# Create a forwarded port mapping which allows access to a specific port
25-
# within the machine from a port on the host machine. In the example below,
26-
# accessing "localhost:8080" will access port 80 on the guest machine.
27-
# config.vm.network "forwarded_port", guest: 80, host: 8080
28-
29-
# Create a private network, which allows host-only access to the machine
30-
# using a specific IP.
31-
# config.vm.network "private_network", ip: "192.168.33.10"
32-
33-
# Create a public network, which generally matched to bridged network.
34-
# Bridged networks make the machine appear as another physical device on
35-
# your network.
36-
# config.vm.network "public_network"
37-
38-
# Share an additional folder to the guest VM. The first argument is
39-
# the path on the host to the actual folder. The second argument is
40-
# the path on the guest to mount the folder. And the optional third
41-
# argument is a set of non-required options.
42-
# config.vm.synced_folder "../data", "/vagrant_data"
43-
44-
# Provider-specific configuration so you can fine-tune various
45-
# backing providers for Vagrant. These expose provider-specific options.
46-
# Example for VirtualBox:
47-
#
48-
# config.vm.provider "virtualbox" do |vb|
49-
# # Display the VirtualBox GUI when booting the machine
50-
# vb.gui = true
51-
#
52-
# # Customize the amount of memory on the VM:
53-
# vb.memory = "1024"
54-
# end
55-
#
56-
# View the documentation for the provider you are using for more
57-
# information on available options.
58-
59-
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
60-
# such as FTP and Heroku are also available. See the documentation at
61-
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
62-
# config.push.define "atlas" do |push|
63-
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
64-
# end
65-
66-
# Enable provisioning with a shell script. Additional provisioners such as
67-
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
68-
# documentation for more information about their specific syntax and use.
69-
config.vm.provision "shell", inline: <<-SHELL
70-
sleep 10
71-
sudo yum -y install rsync httpd wget
72-
sudo systemctl enable httpd.service
73-
sudo systemctl start httpd.service
74-
# CentOS 7
75-
sudo mkdir -p /var/www/html/centos/7.4.1708/os/
76-
sudo ln -s /var/www/html/centos/7.4.1708 /var/www/html/centos/7
77-
sudo rsync -avSHP --delete --exclude "local*" --exclude "isos" mirror.eu.oneandone.net::centos/7.4.1708/os/ /var/www/html/centos/7.4.1708/os/
78-
sudo mkdir -p /var/www/html/epel/7/x86_64/
79-
sudo rsync -vaH --exclude="debug*" --numeric-ids --delete --delete-after --delay-updates rsync://rsync.hrz.tu-chemnitz.de/fedora-epel/7/x86_64/ /var/www/html/epel/7/x86_64/
80-
sudo mkdir -p /var/www/html/puppet5/el/7/x86_64/
81-
sudo rsync -av --copy-links --del rsync://yum.puppet.com/packages/yum/puppet5/el/7/x86_64/ /var/www/html/puppet5/el/7/x86_64/
82-
sudo mkdir -p /var/www/html/foreman/releases/latest/el7/x86_64/
83-
sudo rsync -av --copy-links --del rsync://yum.theforeman.org/yum/releases/latest/el7/x86_64/ /var/www/html/foreman/releases/latest/el7/x86_64/
84-
sudo mkdir -p /var/www/html/foreman/plugins/latest/el7/x86_64/
85-
sudo rsync -av --copy-links --del rsync://yum.theforeman.org/yum/plugins/latest/el7/x86_64/ /var/www/html/foreman/plugins/latest/el7/x86_64/
86-
sudo mkdir -p /var/www/html/foreman/discovery
87-
sudo wget -P /var/www/html/foreman/discovery http://downloads.theforeman.org/discovery/releases/latest/fdi-image-latest.tar
88-
SHELL
5+
config.vm.define "mirror" do |mirror|
6+
mirror.vm.box = "centos/7"
7+
mirror.vm.hostname = "mirror.localdomain"
8+
mirror.vm.synced_folder ".", "/vagrant", type: "rsync"
9+
10+
mirror.vm.provision "shell", inline: <<-SHELL
11+
sleep 10
12+
sudo yum -y install rsync httpd wget
13+
sudo systemctl enable httpd.service
14+
sudo systemctl start httpd.service
15+
# CentOS 8
16+
sudo mkdir -p /var/www/html/centos/8.2.2004/{BaseOS,AppStream}/x86_64
17+
sudo ln -s /var/www/html/centos/8.2.2004 /var/www/html/centos/8
18+
sudo rsync -avSHP --delete --exclude "local*" --exclude "isos" mirror.eu.oneandone.net::centos/8.2.2004/BaseOS/x86_64/ /var/www/html/centos/8.2.2004/BaseOS/x86_64/
19+
sudo rsync -avSHP --delete --exclude "local*" --exclude "isos" mirror.eu.oneandone.net::centos/8.2.2004/AppStream/x86_64/ /var/www/html/centos/8.2.2004/AppStream/x86_64/
20+
sudo mkdir -p /var/www/html/epel/8/{Everything,Modular}/x86_64/
21+
sudo rsync -vaH --exclude="debug*" --numeric-ids --delete --delete-after --delay-updates rsync://rsync.hrz.tu-chemnitz.de/fedora-epel/8/Everything/x86_64/ /var/www/html/epel/8/Everything/x86_64/
22+
sudo rsync -vaH --exclude="debug*" --numeric-ids --delete --delete-after --delay-updates rsync://rsync.hrz.tu-chemnitz.de/fedora-epel/8/Modular/x86_64/ /var/www/html/epel/8/Modular/x86_64/
23+
sudo mkdir -p /var/www/html/puppet6/el/8/x86_64/
24+
sudo rsync -av --copy-links --del --exclude "pdk*" --exclude "puppet-bolt*" --exclude "puppetdb*" --exclude="puppetserver*" rsync://rsync.puppet.com/packages/yum/puppet6/el/8/x86_64/ /var/www/html/puppet6/el/8/x86_64/
25+
sudo mkdir -p /var/www/html/foreman/releases/latest/el8/x86_64/
26+
sudo rsync -av --copy-links --del rsync://rsync.theforeman.org/yum/releases/latest/el8/x86_64/ /var/www/html/foreman/releases/latest/el8/x86_64/
27+
sudo mkdir -p /var/www/html/foreman/plugins/latest/el8/x86_64/
28+
sudo rsync -av --copy-links --del rsync://rsync.theforeman.org/yum/plugins/latest/el8/x86_64/ /var/www/html/foreman/plugins/latest/el8/x86_64/
29+
sudo mkdir -p /var/www/html/foreman/client/latest/el8/x86_64/
30+
sudo rsync -av --copy-links --del rsync://rsync.theforeman.org/yum/client/latest/el8/x86_64/ /var/www/html/foreman/client/latest/el8/x86_64/
31+
sudo mkdir -p /var/www/html/foreman/discovery
32+
sudo rm /var/www/html/foreman/discovery/fdi-image-latest.tar
33+
sudo wget -P /var/www/html/foreman/discovery http://downloads.theforeman.org/discovery/releases/latest/fdi-image-latest.tar
34+
SHELL
35+
end
36+
37+
config.vm.define "foreman" do |foreman|
38+
foreman.vm.box = "centos/8"
39+
foreman.vm.hostname = "foreman.localdomain"
40+
foreman.vm.synced_folder ".", "/vagrant", type: "rsync"
41+
42+
foreman.vm.provision "shell", path: "_files/share/foreman/finish.sh"
43+
end
44+
45+
config.vm.define "monitoring" do |foreman|
46+
foreman.vm.box = "centos/8"
47+
foreman.vm.hostname = "monitoring.localdomain"
48+
foreman.vm.synced_folder ".", "/vagrant", type: "rsync"
49+
50+
foreman.vm.provision "file", source: "_files/share/monitoring/monitoring.localdomain.pp", destination: "~/"
51+
foreman.vm.provision "file", source: "_files/share/monitoring/icingaweb2.conf", destination: "~/"
52+
foreman.vm.provision "shell", path: "_files/share/monitoring/finish.sh"
53+
end
8954
end
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ echo "10.0.0.1 host.localdomain host" >> /etc/hosts
33
echo "10.0.0.2 foreman.localdomain foreman" >> /etc/hosts
44
echo "10.0.0.3 monitoring.localdomain monitoring" >> /etc/hosts
55

6-
yum install -y openldap-servers openldap-clients
6+
yum install -y wget
7+
wget -q https://repo.symas.com/configs/SOFL/rhel8/sofl.repo -O /etc/yum.repos.d/sofl.repo
8+
yum install -y symas-openldap-servers symas-openldap-clients
79

8-
echo 'dn: olcDatabase={2}hdb,cn=config
10+
echo 'dn: olcDatabase={2}mdb,cn=config
911
changetype: modify
1012
replace: olcSuffix
1113
olcSuffix: dc=localdomain

_files/share/monitoring/finish.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
yum install epel-release -y
3-
yum install http://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm -y
3+
yum install http://yum.puppetlabs.com/puppet6/puppet6-release-el-8.noarch.rpm -y
44
yum install puppet-agent -y
55
/opt/puppetlabs/bin/puppet module install puppetlabs-apache
66
/opt/puppetlabs/bin/puppet module install puppetlabs-mysql
77
/opt/puppetlabs/bin/puppet module install icinga-icinga2
88
/opt/puppetlabs/bin/puppet module install icinga-icingaweb2
9-
/opt/puppetlabs/bin/puppet apply monitoring.localdomain.pp
9+
/opt/puppetlabs/bin/puppet apply -v monitoring.localdomain.pp

advanced/01_web.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ For more details see: http://theforeman.org/manuals/latest/index.html#4.1.5Searc
3737
* Graphs changes in your enviroment
3838
* Configured in the WebGUI and collected by a cronjob
3939
* Internal Host parameters or Facts provided by Configuration Management
40+
* Moved to a separate plugin with Foreman 2.2
4041
4142
<div style="text-align:right">
4243
<img src="./_images/foreman-trend-puppetversion.png" style="float: right, max-width:200px; max-height: 300px; width: auto; height: auto; margin-top: 50px; margin-right: 260px" alt="Foreman Trends"/>
@@ -48,8 +49,10 @@ For more details see: http://theforeman.org/manuals/latest/index.html#4.1.5Searc
4849
4950
<br/>
5051
Foreman can provide graphs about changes in your environment. Those are configured and displayed in the WebGUI in
51-
"Monitor > Trends" and a cronjob is performs the data collection. By default this cronjob runs every 30 minutes matching
52+
"Monitor > Trends" and a cronjob performs the data collection. By default this cronjob runs every 30 minutes matching
5253
Puppet's default run interval because most trends will be based on the facts collected by the configuration management
5354
solution, another source are Foreman's internal parameters like the operatingsystem of the host.
5455
56+
This functionality was moved to a separate plugin with Foreman 2.2 which can enabled using `foreman-installer --enable-foreman-plugin-statistics`.
57+
5558
~~~ENDSECTION~~~

advanced/02_cleanup.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Requires a lot of space
1313

1414
* Cleanup job is provided by the Foreman
15-
* Execute via cron
15+
* Executed via cron
1616
* Can run with different parameters
1717

1818
~~~SECTION:handouts~~~
@@ -24,13 +24,13 @@ Depending on the solution, configuration and interval the required storage space
2424
2525
~~~PAGEBREAK~~~
2626
27-
Foreman provides a cleanup job for this. Best Practice would be an execution as a cronjob. The command takes parameters
27+
Foreman provides a cleanup job for this in form of a cronjob. Best Practice would be to adjust is based on your needs. The command takes parameters
2828
for the maximum age to keep the status of the reports.
2929
30-
Depending on your needs configure a daily cronjob like this to delete all reports 'without event', 'after one day' or
30+
For example configure the daily cronjob like this to delete all reports 'without event' 'after one day' and
3131
those with events 'after 7 days'.
3232
33-
#!/bin/sh
33+
# vi /etc/cron.d/foreman
3434
foreman-rake reports:expire days=1 status=0
3535
foreman-rake reports:expire days=7
3636
@@ -142,6 +142,7 @@ and see pending config changes, if some are shown run the foreman-installer agai
142142
* Restore
143143
* Handles Updates including Health checks
144144
* Maintenance mode prevents access to Foreman
145+
* Yum plugin prevents unexpected package sources
145146
146147
~~~SECTION:handouts~~~
147148
@@ -150,6 +151,8 @@ and see pending config changes, if some are shown run the foreman-installer agai
150151
Foreman Maintain is a newly developed tool which tries to automate the previous tasks. It can handle multiple strategies for backup and restore,
151152
like offline and online, full and incremental. It ensures system health during Update and its maintenance mode prevents access to Foreman.
152153
154+
The yum plugin "foreman-protector" is created to prevent accidental updates of packages from unexpected sources.
155+
153156
For more information: https://theforeman.org/plugins/foreman_maintain/0.2/index.html
154157
155158
~~~ENDSECTION~~~

advanced/03_api.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
* Requires username and password
1212
* Collections are paged
1313
* Search strings like provided in the WebGUI
14+
* GraphQL
15+
* Available since 1.22, still considered experimental
16+
* Intended for development
1417

1518
~~~SECTION:handouts~~~
1619
@@ -24,9 +27,13 @@ in the WebGUI but they have to be URL encoded.
2427
2528
~~~PAGEBREAK~~~
2629
30+
Another API was introduced with GraphQL in 1.22. This API is more intended for development of
31+
plugins instead of scripting and still considered experimental, but should cover all objects
32+
of the core now and be available for a good number of plugins already.
33+
2734
Usage explainations can be found at http://theforeman.org/manuals/latest/index.html#5.1API
2835
29-
API documentation is located at http://theforeman.org/api/1.18/index.html
36+
API documentation is located at http://theforeman.org/api/2.0/index.html
3037
3138
~~~ENDSECTION~~~
3239
@@ -71,20 +78,20 @@ API documentation is located at http://theforeman.org/api/1.18/index.html
7178
### Query the API for all subnets using the URL endpoint "/api/subnets"
7279
7380
# curl -k -u admin:PASSWORD -H "Accept: version=2,application/json" \
74-
https://foreman.localdomain/api/subnets | python -m json.tool
81+
https://foreman.localdomain/api/subnets | python3 -m json.tool
7582
7683
### Query the API for all Debian hosts using the URL endpoint "/api/hosts" and the search "os=Debian" or "facts.osfamily=Debian"
7784
7885
If you want to see all systems configured in Foreman with operating system "Debian" run the following curl command.
7986
This will also include hosts with provisioning pending.
8087
8188
# curl -k -u admin:PASSWORD -H "Accept: version=2,application/json" \
82-
https://foreman.localdomain/api/hosts?search=os%3DDebian | python -m json.tool
89+
https://foreman.localdomain/api/hosts?search=os%3DDebian | python3 -m json.tool
8390
8491
If you want to see all systems reported to run operating system "Debian" :
8592
8693
# curl -k -u admin:PASSWORD -H "Accept: version=2,application/json" \
87-
https://foreman.localdomain/api/hosts?search=facts.osfamily%3DDebian | python -m json.tool
94+
https://foreman.localdomain/api/hosts?search=facts.osfamily%3DDebian | python3 -m json.tool
8895
8996
### Create a hostgroup "training" using the API with valid defaults
9097
@@ -94,12 +101,12 @@ In the following command the ids depend on your environment and may differ:
94101
-X POST -d '{ "name":"training", "environment_id":1, "puppet_ca_proxy_id":1, "puppet_proxy_id":1,
95102
"subnet_id":1, "domain_id":1, "architecture_id":1, "operatingsystem_id":1, "medium_id":1, "ptable_id":94,
96103
"root_pass":"start123", "organization_id":2, "location_id":1 }' \
97-
https://foreman.localdomain/api/hostgroups | python -m json.tool
104+
https://foreman.localdomain/api/hostgroups | python3 -m json.tool
98105
99106
### Change the root password for the hostgroup "training" using the API
100107
101108
You can verify the change in the Audits menu afterwards with:
102109
103110
# curl -k -u admin:PASSWORD -H "Accept: version=2,application/json" -H "Content-Type: application/json" \
104111
-X PUT -d '{ "root_pass":"St@rt123" }' \
105-
https://foreman.localdomain/api/hostgroups/training | python -m json.tool
112+
https://foreman.localdomain/api/hostgroups/training | python3 -m json.tool

advanced/04_cli.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ environment, so feel free to create your own plugins to solve your own administr
2424
2525
<br/>
2626
27-
A list of plugins is provided by the Github page of the framework: https://github.com/theforeman/hammer-cli
27+
An incomplete list of plugins is provided by the Github page of the framework: https://github.com/theforeman/hammer-cli
2828
2929
~~~ENDSECTION~~~
3030
@@ -79,19 +79,19 @@ Adjust the configuration if required in `~/.hammer/cli.modules.d/foreman.yml`:
7979
8080
### Create the new Operatingsystem entry for "CentOS 6.8"
8181
82-
# hammer os create --name CentOS --major 6 --minor 8 --description "CentOS 6.8" --architectures x86_64 \
83-
--family "Redhat" --password-hash SHA256 --media "CentOS mirror" --partition-tables "Kickstart default"
82+
# hammer os create --name CentOS --major 7 --minor 8 --description "CentOS 7.8" --architectures x86_64 \
83+
--family "Redhat" --password-hash SHA256 --media "CentOS 7 mirror" --partition-tables "Kickstart default"
8484
8585
### Associate the template "Kickstart default PXELinux" and set as default template
8686
8787
The ids may vary depending on our environment but you can get them with the list subcommands.
8888
8989
# hammer template add-operatingsystem --name "Kickstart default PXELinux" \
90-
--operatingsystem "CentOS 6.8"
91-
# hammer os set-default-template --config-template-id 35 --id 6
90+
--operatingsystem "CentOS 7.8"
91+
# hammer os set-default-template --provisioning-template-id 35 --id 6
9292
9393
### Associate the template "Kickstart default" and set as default template
9494
9595
# hammer template add-operatingsystem --name "Kickstart default" \
96-
--operatingsystem "CentOS 6.8"
97-
# hammer os set-default-template --config-template-id 31 --id 6
96+
--operatingsystem "CentOS 7.8"
97+
# hammer os set-default-template --provisioning-template-id 31 --id 6

0 commit comments

Comments
 (0)