Fix apt state with Ubuntu 22.04 & clean up icinga2 state #173
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
apt state
We installed
python-apt
, which on Ubuntu is still pointing towards the Python2 variant.On Ubuntu 22.04, this is not available anymore. Since we don't actually need the Python2 package, but the Python3 one, it is changed to
python3-apt
A
sources.list
template for Ubuntu 22.04 has been created , this state was failing for the vm-hosts as it couldn't find a file.We'll have to add the one for 24.04 soon as well.
icinga2 state
Basically we had a bit of a mess in terms of using
roles
/minion_roles
,role
/minion_role
anddevice_role
/minion_device_role
:roles
/minion_roles
is pointing to the unused and unmaintainednetbox:config_context:roles
(only a handful of VMs had seticinga2_client
there in the netbox config context, but it wasn't referenced anywhere, instead we are using the tagicinga2_client
).device_role
/minion_device_role
points to the deprecateddevice_role
property of devices in netbox. The "new"role
property has been introduced, matching VMs and other objects.device_role
is a synonym forrole
in netbox 3.x and removed in netbox 4.0 (further cleanup in other states needed before we upgrade netbox).I have removed/replaced it with the
role
/minion_role
mine function.role
/minion_role
data is not a list, but a single value. The code has been changed in a lot of places to account for this.Additionally, some icinga services/checks had broken conditions, like checking for roles which don't exist anymore or no VM has assigned anymore (
dnsserver
,gateway
, ...). I fixed those, mostly changing the conditions to match on either the new roles (nextgen-gateway
) or on the host tags (dnsdist
,recursor
,authorative-dns
,docker
...).