Closed ralfbosz closed 6 years ago
Not as far as I know using rhsm_register.
The underlying /sbin/subscription-manager
command behaves this way. The native types are a thin wrapper around this.
The puppet classes try to handle this case but really do not have enough information to deal with it in this case.
You will have to provide that information to Puppet to "fix" this behavior. Consider the output of /sbin/subscription-manager status
. Combine that status with knowing if you need to update the hostname or certname of your Katello or Satellite installation. These two data will tell you if you should force a registration or not. It may require you to purge the registration then re-register it.
If you just blindly apply force it must try to re-register on every run. This causes exceptionally high load on a Katello or Satellite system. It can break the SAM part of Satellite when the host records are locked (errored tasks will pile up in the task list with locks on the host records.)
Note that Satelite 6.1.2 and later have a fix in that reduces the issue somewhat of running with --force
. Duplicate hosts that try to re-register with a valid registration are combined into a single record with no changes. In Satellite 6.1.1 and older this would actually duplicate the host record. Over a few weeks this leads to thousands of invalid duplicate content hosts in the database.
It maybe designed this way, but I would suspect that a "force => true" for rhsm_register would RE-register a system every puppet-run (not ideal, but that is what force would suggest).
When doing this:
The run does nothing:
During some troubleshooting I found out that if the $title is the same as the hostname configured with rhsm_config, it skips (even with force) the re-register part. If I change the $title to something other, the rhsm_register is run. But when you remove the force from that one, the register is run every puppet-run (what we didn't want).
Some debug added to show how the command is run without --force. Is it not possible to force a re-register this way?