waveclaw / puppet-subscription_manager

Handle Client Registration to RedHat Satellite 6 or Katello
https://rhn.redhat.com
Other
6 stars 34 forks source link

rhsm_register only occurs if /var/cache/rhsm/identity.yaml is manually deleted #96

Closed markasammut closed 4 years ago

markasammut commented 4 years ago

I have tried deploying the module on our setup, running Puppet Open Source puppetserver 5.3.11, puppetdb 5.2.12, and puppet agent 5.5.18, on RHEL 7, with subscriptions being managed by RedHat Satellite 6.6.

We needed to re-subscribe all our hosts with a new activation key. I have tried to set force => true, I have tried to manually run subscription-manager unregister and subscription-manager clean, but module still does nothing unless I manually deleted /var/cache/rhsm/identity.yaml.

I would have expected the module to force an unregister and clean process and force a subscription-manager register with the new activationkey, but it seems it does nothing if it finds an existing value populating the rhsm_identity fact.

markasammut commented 4 years ago

This is the way we implemented it.

class { 'subscription_manager':
        server_hostname => $redhat_satellite_server,
        org             => $redhat_satellite_org,
        activationkey   => $redhat_satellite_activationkey,
        service_status  => $service_status,
        config_hash     => {
          server_hostname              => $redhat_satellite_server,
          server_insecure              => 0,
          server_prefix                => '/rhsm',
          server_port                  => 8443,
          server_proxy_hostname        => $proxy,
          server_proxy_port            => $proxyport,
          server_ssl_verify_depth      => 3,
          rhsm_baseurl                 => "https://${redhat_satellite_server}/pulp/repos",
          rhsm_full_refresh_on_yum     => 1,
          rhsm_manage_repos            => 1,
          rhsm_repo_ca_cert            => '%(ca_cert_dir)skatello-server-ca.pem',
          rhsm_report_package_profile  => 1,
          rhsm_auto_enable_yum_plugins => 1,
        },
        force           => true,
      }
NikTheDusky commented 4 years ago

We are also running Puppet 5.5 on RHEL 7 and experiencing the same problems, except that just deleting /var/cache/rhsm/identity.yaml isn't enough - we first have to run subscription-manager unregister. After that, rhsm_register correctly registers with the new activation key or username and password.

waveclaw commented 4 years ago

We are also running Puppet 5.5 on RHEL 7 and experiencing the same problems, except that just deleting /var/cache/rhsm/identity.yaml isn't enough - we first have to run subscription-manager unregister. After that, rhsm_register correctly registers with the new activation key or username and password.

That only happens if you are in fact not changing the keys or you are using usernames and passwords. In this case the module is behaving as expected.

If you want to re-register systems then you have to do it yourself using the native types directly. As documented both in the module's code and the help page you cannot blindly use the module to re-register systems with the same identity over and over.

This leads to massive duplication of servers in 6.2 and earlier Satellite systems or Katello 3.1 or earlier systems.

So this feature is explicitly disallowed for the generic 'friendly' module. It is not a happy path, you must use the native types directly and cobble together your own method of figuring out if you need to re-register.

@markasammut 's problems are more interesting. The code in the module is supposed to handle that case explicitly but relies upon a bug #94 being solved. I have a workaround for this in the next release.

However, I can no longer integration test this module. I do not support Puppet as part of my work so depend upon others to test these on their systems. If you continue to have issues, please submit tests and code or fork the module and support it yourself. I cannot dontate this module to Voxpupli due to the lack of ownership for all code.

markasammut commented 4 years ago

So pulling the latest commit on the master branch should get me testing this fix in the new release?