- Docs »
- rhsm_repository - Manage RHSM repositories using the subscription-manager command
-
You are reading an unmaintained version of the Ansible documentation. Unmaintained Ansible versions can contain unfixed security vulnerabilities (CVE). Please upgrade to a maintained version. See the latest Ansible documentation.
rhsm_repository - Manage RHSM repositories using the subscription-manager command
- Manage(Enable/Disable) RHSM repositories to the Red Hat Subscription Management entitlement platform using the
subscription-manager
command.
The below requirements are needed on the host that executes this module.
Parameter |
Choices/Defaults |
Comments |
name
required |
|
The ID of repositories to enable.
To operate on several repositories this can accept a comma separated list or a YAML list.
|
state
required |
Choices:
present ←
- enabled
- absent
- disabled
|
If state is equal to present or disabled, indicates the desired repository state.
|
Note
- In order to manage RHSM repositories the system must be already registered to RHSM manually or using the Ansible
redhat_subscription
module.
- name: Enable a RHSM repository
rhsm_repository:
name: rhel-7-server-rpms
- name: Disable all RHSM repositories
rhsm_repository:
name: '*'
state: disabled
- name: Enable all repositories starting with rhel-6-server
rhsm_repository:
name: rhel-6-server*
state: enabled
- name: Disable all repositories except rhel-7-server-rpms
rhsm_repository:
name: "{{ item }}"
state: disabled
with_items: "{{
rhsm_repository.repositories |
map(attribute='id') |
difference(['rhel-7-server-rpms']) }}"
Common return values are documented here, the following are the fields unique to this module:
Key |
Returned |
Description |
repositories
list
|
success |
The list of RHSM repositories with their states.
When this module is used to change the repositories states, this list contains the updated states after the changes.
|
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
- Giovanni Sciortino (@giovannisciortino)
Hint
If you notice any issues in this documentation you can edit this document to improve it.