ansible.builtin.rhsm_repository (v2.7.10) — module

Manage RHSM repositories using the subscription-manager command

| "added in version" 2.5 of ansible.builtin"

Authors: Giovanni Sciortino (@giovannisciortino)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.7.10

Description

Manage(Enable/Disable) RHSM repositories to the Red Hat Subscription Management entitlement platform using the C(subscription-manager) command.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable a RHSM repository
  rhsm_repository:
    name: rhel-7-server-rpms
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disable all RHSM repositories
  rhsm_repository:
    name: '*'
    state: disabled
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable all repositories starting with rhel-6-server
  rhsm_repository:
    name: rhel-6-server*
    state: enabled
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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']) }}"

Inputs

    
name:
    description:
    - The ID of repositories to enable.
    - To operate on several repositories this can accept a comma separated list or a YAML
      list.
    required: true

state:
    choices:
    - present
    - enabled
    - absent
    - disabled
    default: present
    description:
    - If state is equal to present or disabled, indicates the desired repository state.
    required: true

Outputs

repositories:
  description:
  - 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.
  returned: success
  type: list