Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0.0 < 9.0.0
Start using this module
Add this module to your Puppetfile:
mod 'puppet-rhsm', '5.3.0'
Learn more about managing modules with a PuppetfileDocumentation
rhsm
Table of Contents
Description
This module registers your systems with Red Hat Subscription Management.
Setup
Just declare the module with parameters, or load the data from Hiera.
Types
rh_repo
Manage yum repos via the subscription-manager.
rh_subscription
Enable or disable RH subscriptions based on their pool ID.
Usage
class { 'rhsm':
rh_user => 'myuser',
rh_password => 'mypassword',
}
Use rh_repo
type to add a repository:
rh_repo { 'rhel-7-server-extras-rpms':
ensure => present,
}
Use rh_subscription
type to add or remove a subscription based on its pool ID:
rh_subscription { '8e8e7f7a77554a776277ac6dca654':
ensure => present,
}
Hiera (recommended)
include rhsm
Hierafile:
rhsm::rh_user: myuser
rhsm::rh_password: mypassword
Proxy
If the RedHat node must use a proxy to access the internet, you'll have to provide at least the hostname and TCP port.
class { 'rhsm':
proxy_hostname => 'my.proxy.net',
proxy_port => 8080
rh_user => 'myuser',
rh_password => 'mypassword',
}
If you don't specify the protocol, subscription-manager will use HTTP. If you want to connect via HTTPS, set the proxy_scheme
to https
. For proxies with authentication, specify the proxy_user
and proxy_password
values.
Depending on your environment, you also migh need to set the no_proxy
value.
The proxy settings will be used to register the system and as connection option for all the YUM repositories generated in /etc/yum.repos.d/redhat.repo
Enabled Repos
A string array of repo IDs can be provided as an argument to the class definition. This list will be used to enable the target repos if that has not already occurred.
The following example enables the server and optional RPMs:
class { 'rhsm':
rh_user => 'myuser',
rh_password => 'mypassword',
enabled_repo_ids => [
'rhel-7-server-rpms',
'rhel-7-server-optional-rpms'
]
}
Alternatively, hiera can be utilized to specify these arguments.
rhsm::rh_user: myuser
rhsm::rh_password: mypassword
rhsm::enabled_repo_ids:
- 'rhel-7-server-rpms',
- 'rhel-7-server-optional-rpms'
Satellite 6
Registering with Red Hat Satellite 6 needs some additional settings.
class { 'rhsm':
activationkey => 'act-lce-rhel-7,act-product',
org => 'satellite_organization',
servername => 'satellite.example.com',
serverprefix => '/rhsm',
repo_ca_cert_filename => 'katello-server-ca.pem',
repo_ca_cert_source => 'puppet:///modules/profile/katello-server-ca.crt',
full_refresh_on_yum => 1,
baseurl => 'https://satellite.example.com/pulp/repos',
}
- You need to specify either (
rh_user
andrh_password
) or (org
andactivationkey
). - Multiple Activationkeys might be provided, separated by comma.
- Download the corresponding certificate from your Satellite (https://satellite.example.com/pub/katelllo-server-ca.crt) and publish it, e.g. with a (profile) module.
Dnf/Yum plugin configuration
You can also configure the dnf/yum plugin via the $plugin_settings
parameter.
rhsm::plugin_settings:
main:
enabled:1
disable_system_repos:1
Limitations
Well, only RedHat is supported :)
Development
Some general guidelines on PR structure can be found here.
Reference
Table of Contents
Classes
rhsm
: Subscribe the node to RHSM
Resource types
rh_repo
: Manage Red Hat subscriptionsrh_subscription
: Manage Red Hat subscriptions
Classes
rhsm
rhsm
Subscribe the node to RHSM
Copyright 2014 Ger Apeldoorn, unless otherwise noted.
Examples
include rhsm
# Hierafile:
---
rhsm::rh_user: myuser
rhsm::rh_password: mypassword
Parameters
The following parameters are available in the rhsm
class:
rh_user
rh_password
org
activationkey
servername
serverprefix
serverport
ca_cert_dir
repo_ca_cert_filename
repo_ca_cert_source
manage_repos
full_refresh_on_yum
proxy_hostname
proxy_scheme
proxy_port
proxy_user
proxy_password
no_proxy
baseurl
package_ensure
enabled_subscription_ids
enabled_repo_ids
server_timeout
inotify
process_timeout
manage_repo_filename
repo_filename
plugin_settings
package_profile_on_trans
rh_user
Data type: Optional[String[1]]
User for the Customer Portal. You need to specify either (rh_user and rh_password) or (org and activationkey)
Default value: undef
rh_password
Data type: Optional[String[1]]
Password for the rh_user account
Default value: undef
org
Data type: Optional[String[1]]
Organization to use
Default value: undef
activationkey
Data type: Optional[String[1]]
Activationkey to use
Default value: undef
servername
Data type: Stdlib::Fqdn
Servername, default provided Used directly in rhsm.conf template
Default value: 'subscription.rhsm.redhat.com'
serverprefix
Data type: Stdlib::Absolutepath
server.prefix to use Used directly in rhsm.conf template /rhsm for Satellite 6 /subscription for RHSM
Default value: '/subscription'
serverport
Data type: Stdlib::Port
server.port to use Used directly in rhsm.conf template
Default value: 443
ca_cert_dir
Data type: Stdlib::Absolutepath
Server CA certificate location
Default value: '/etc/rhsm/ca/'
repo_ca_cert_filename
Data type: String[1]
File containting the CA cert to use when generating yum repo configs katello-server-ca.pem for Satellite 6 redhat-uep.pem for RHSM
Default value: 'redhat-uep.pem'
repo_ca_cert_source
Data type: Optional[String[1]]
URI, if set the content is used for CA file resource ${ca_cert_dir}/${repo_ca_cert_filename} Possible values are puppet:, file: and http:
Default value: undef
manage_repos
Data type: Integer[0,1]
1 if subscription manager should manage yum repos file or 0 if the subscription is only used for tracking purposes
Default value: 1
full_refresh_on_yum
Data type: Integer[0,1]
rhsm.full_refresh_on_yum Used directly in rhsm.conf template 1 for Satellite 6 0 for RHSM
Default value: 0
proxy_hostname
Data type: Optional[Stdlib::Fqdn]
Proxy hostname
Default value: undef
proxy_scheme
Data type: Enum['http', 'https']
Proxy scheme
Default value: 'http'
proxy_port
Data type: Optional[Stdlib::Port]
Proxy port
Default value: undef
proxy_user
Data type: Optional[String[1]]
Proxy user
Default value: undef
proxy_password
Data type: Optional[String[1]]
Proxy password
Default value: undef
no_proxy
Data type: Optional[String[1]]
no_proxy definition
Default value: undef
baseurl
Data type: Stdlib::Httpurl
Base URL for rhsm, default provided
Default value: 'https://cdn.redhat.com'
package_ensure
Data type: String[1]
Whether to install subscription-manager, directly passed to the ensure
param of the package.
Default value: 'installed'
enabled_subscription_ids
Data type: Array[String[1]]
A listing of subscription IDs to provide to the subscription-manager attach --pool command.
Default value: []
enabled_repo_ids
Data type: Array[String[1]]
A listing of the Repo IDs to provide to the subscription-manager repo --enable command.
Default value: []
server_timeout
Data type: Integer[0]
HTTP timeout in seconds
Default value: 180
inotify
Data type: Integer[0,1]
Inotify is used for monitoring changes in directories with certificates. When this directory is mounted using a network file system without inotify notification support (e.g. NFS), then disabling inotify is strongly recommended.
Default value: 1
process_timeout
Data type: Integer[0]
The time in seconds we will allow the rhsmd cron job to run before terminating the process.
Default value: 300
manage_repo_filename
Data type: Boolean
Should puppet try to manage the repo file subscription-manager uses?
Default value: true
repo_filename
Data type: Stdlib::Absolutepath
The name of the repo file subscription-manager uses.
Default value: '/etc/yum.repos.d/redhat.repo'
plugin_settings
Data type: Hash
Hash of {section => {key => value } } for the yum/dnf plugin.
Default value: { 'main' => { 'enabled' => 1 } }
package_profile_on_trans
Data type: Integer[0,1]
Run the package profile on each yum/dnf transaction
Default value: 0
Resource types
rh_repo
Manage Red Hat subscriptions
Properties
The following properties are available in the rh_repo
type.
ensure
Valid values: present
, enabled
, absent
, disabled
Aliases: "enabled"=>"present", "disabled"=>"absent"
The basic property that the resource should be in.
Parameters
The following parameters are available in the rh_repo
type.
name
namevar
provider
The specific backend to use for this rh_repo
resource. You will seldom need to specify this --- Puppet will usually
discover the appropriate provider for your platform.
rh_subscription
Manage Red Hat subscriptions
Properties
The following properties are available in the rh_subscription
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
Parameters
The following parameters are available in the rh_subscription
type.
name
namevar
provider
The specific backend to use for this rh_subscription
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
serial
Changelog
All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module.
v5.3.0 (2024-05-25)
Implemented enhancements:
v5.2.0 (2023-12-19)
Implemented enhancements:
- Add Puppet 8 support #139 (bastelfreak)
- Allow subscriptions to be attached via hiera #136 (tedgarb)
- add fact for rhsm.available_repo_ids #133 (sigbjornaib)
- Add a switch to prevent caring about redhat.repo if needed #128 (jcpunk)
v5.1.0 (2022-07-25)
Implemented enhancements:
- When purging unmanaged repos, this file needs to be known to puppet. #125 (jcpunk)
- Add package_profile_on_trans #123 (marcelfischer)
Fixed bugs:
v5.0.0 (2022-04-28)
Breaking changes:
- modulesync 5.2.0 / Drop EoL Puppet 5 support #118 (bastelfreak)
Implemented enhancements:
- Add way to configure the dnf/yum plugin #121 (jcpunk)
- add no_proxy to rhsm.conf, defaults to undef #117 (darktim)
v4.1.0 (2021-09-27)
Implemented enhancements:
- Enable Puppet 7 support #115 (bastelfreak)
- add proxy_scheme (defaults to 'http') #112 (jorgemorgado)
- Add process_timeout parameter #105 (treydock)
- Add server info to facts #103 (yakatz)
- Add Sensitive to RHSM exec and update metadata #96 (rcalixte)
Fixed bugs:
Closed issues:
- Yumrepo target parameter does not work #68
Merged pull requests:
v4.0.0 (2020-01-15)
Breaking changes:
- Eliminates subscription-manager exec on every Puppet run #95 (speer)
- modulesync 2.5.1 and drop Puppet 4 #84 (bastelfreak)
Implemented enhancements:
- Features request: SCL repos #66
- Add types and providers from crayfishx/puppet-rhsm #88 (kallies)
- Add defaults and make server_timeout and inotify configurable #86 (kallies)
- Move RHSM-subscribe dependency inside repo type #83 (speer)
Closed issues:
- Don't enforce latest package to be installed as default value #92
- Read facts from /etc/yum.repos.d/redhat.repo instead of subscription-manager #90
- Use types and providers for subscriptions and repositories #87
- Update rhsm.conf template #85
Merged pull requests:
- travis: dont upgrade bundler #99 (bastelfreak)
- Allow
puppetlabs/stdlib
6.x #93 (alexjfisher)
v3.2.0 (2018-10-20)
Implemented enhancements:
Merged pull requests:
- modulesync 2.2.0 and allow puppet 6.x #79 (bastelfreak)
v3.1.0 (2018-09-06)
Implemented enhancements:
Closed issues:
- Add fact for subscription management type #64
- Puppet agent run fails if the system is not already registered with RHSM #62
Merged pull requests:
- allow puppetlabs/stdlib 5.x #75 (bastelfreak)
- Remove docker nodesets #71 (bastelfreak)
- drop EOL OSs; fix puppet version range #70 (bastelfreak)
v3.0.0 (2017-11-21)
Breaking changes:
Fixed bugs:
Closed issues:
- repo_optional always caused puppet run to make change #58
- Each entry in /etc/rhsm/rhsm.conf should be a configurable param #11
- help with process in using this module #6
v2.1.1 (2017-10-10)
Fixed bugs:
v2.1.0 (2017-10-09)
Implemented enhancements:
- Update rhsm.conf template (5.15.1) and add configurable params #50 (kallies)
- Change documentation syntax to YARD/Puppet Strings #48 (kallies)
Fixed bugs:
yum repolist
in fact rhsm_repos leads to deadlock #52- Change servername to subscription.rhsm.redhat.com #49 (kallies)
Merged pull requests:
- release 2.1.0 #54 (bastelfreak)
- Use subscription-manager instead of yum for listing enabled repos #53 (kallies)
v2.0.0 (2017-07-06)
Fixed bugs:
- Add confine rule on Fact #46 (tux-o-matic)
- Add 'Expired' in grep to trigger subscription #45 (tux-o-matic)
Closed issues:
- RHNSM-register fails #38
Merged pull requests:
- Release 2.0.0 #47 (bastelfreak)
- The yumrepo parameter
enabled
had a typo. #43 (rnelson0) - Add LICENSE file #41 (alexjfisher)
- Read from both stdout and stderr for Exec onlyif #39 (tux-o-matic)
v1.1.0 (2017-02-11)
Merged pull requests:
- Added more path for Exec resources #32 (tux-o-matic)
v1.0.0 (2016-12-25)
Closed issues:
- Fact 'rhsm_repos' shouldn't depend on a web API call #18
- Should RHSM be compatible with CentOS? #16
- Expand README to include examples of using proxy #12
Merged pull requests:
- release 1.0.0 #31 (bastelfreak)
- modulesync 0.16.6 #30 (bastelfreak)
- Set min version_requirement for Puppet + bump dep #29 (juniorsysadmin)
- Added '/usr/bin' to path for Exec #26 (tux-o-matic)
- Add org and activationkey paramters #25 (treydock)
- Separated Registration and Subscription tasks #21 (tux-o-matic)
- Remove CentOS from target OS list and added RHEL 5.7 #20 (tux-o-matic)
- Moved Fact to correct path and using YUM rather than subscription-manager #19 (tux-o-matic)
- Separated Extras/Optional repo settings from the registration with 'a… #17 (tux-o-matic)
- Added documentation for HTTP proxy settings #13 (tux-o-matic)
- Use built-in Yumrepo resource type instead of Exec #10 (tux-o-matic)
v0.3.0 (2016-07-21)
Merged pull requests:
- release 0.3.0 #9 (bastelfreak)
- Added support for unauthenticated proxy and pool attach #5 (tux-o-matic)
- General Improvements-revised #4 (VeriskPuppet)
- Changed the addition repos to be based on ${::operatingsystemmajrelease} #1 (jercra)
* This Changelog was automatically generated by github_changelog_generator
Dependencies
- puppetlabs-stdlib (>= 4.18.0 < 10.0.0)
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.