automatically remove content-hosts that seem unsused
katello-cleanup can be used to remove stale content-hosts from Katello. It is needed when a machine gets re-deployed but the old content-host entry is not removed or when a machine was decomissioned on the VM/HW side, but never removed from Katello.
When run, katello-cleanup will execute the following steps:
- Iterate over all content hosts of your organization
- Verify that the hostname is not on the ignore list
- Check if the last checkin time is more than
ageseconds ago - Check if there is another machine with a newer checkin time and the same hostname
- Remove the machine if it is either an older duplicate or too old by itself.
-U,--uri=URIURI to the Foreman/Katello-t,--timeout=TIMEOUTtimeout (in seconds) for the API calls-u,--user=USERUser to log in to Foreman/Katello-p,--pass=PASSPassword to log in to Foreman/Katello-o,--organization-id=IDID of the Organization-c,--config=FILEconfiguration in YAML format-n,--noopdo not actually execute anything
katello-cleanup can be configured using an YAML file (katello-cleanup.yaml by default).
The configuration file consists of one main sections: settings.
The settings section allows to set the same details as the commandline options. Any options given on the command line will override the respective config file settings.
:settings:
:user: admin
:pass: changeme
:uri: https://localhost
:org: 1
:timeout: 300
:age:
:ignore:
- esx.*\.example\.com
The age and ignore settings have no command line name. age is the time in seconds since the last checkin of a machine to be considered stale. ignore is an array of regular expressions that will be matched against the hostnames of content hosts in Katello. Hostnames matching will not be removed even if the logic says they should be.