theforeman.foreman.repository_set – Enable/disable Red Hat Repositories available through subscriptions¶
Note
This plugin is part of the theforeman.foreman collection (version 1.5.1).
To install it use: ansible-galaxy collection install theforeman.foreman
.
To use it in a playbook, specify: theforeman.foreman.repository_set
.
New in version 1.0.0: of theforeman.foreman
Parameters¶
Examples¶
- name: "Enable RHEL 7 RPMs repositories"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "Red Hat Enterprise Linux 7 Server (RPMs)"
organization: "Default Organization"
product: "Red Hat Enterprise Linux Server"
repositories:
- releasever: "7.0"
basearch: "x86_64"
- releasever: "7.1"
basearch: "x86_64"
- releasever: "7.2"
basearch: "x86_64"
- releasever: "7.3"
basearch: "x86_64"
state: enabled
- name: "Enable RHEL 7 RPMs repositories with label"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: rhel-7-server-rpms
repositories:
- releasever: "7.0"
basearch: "x86_64"
- releasever: "7.1"
basearch: "x86_64"
- releasever: "7.2"
basearch: "x86_64"
- releasever: "7.3"
basearch: "x86_64"
state: enabled
- name: "Disable RHEL 7 Extras RPMs repository"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: Red Hat Enterprise Linux 7 Server - Extras (RPMs)
organization: "Default Organization"
product: Red Hat Enterprise Linux Server
state: disabled
repositories:
- basearch: x86_64
- name: "Enable RHEL 8 BaseOS RPMs repository with label"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: rhel-8-for-x86_64-baseos-rpms
repositories:
- releasever: "8"
- name: "Enable Red Hat Virtualization Manager RPMs repository with label"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: "rhel-7-server-rhv-4.2-manager-rpms"
repositories:
- basearch: x86_64
state: enabled
- name: "Enable Red Hat Virtualization Manager RPMs repository without specifying basearch"
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: "rhel-7-server-rhv-4.2-manager-rpms"
all_repositories: true
state: enabled
- name: "Search for possible repository sets of a product"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
resource: repository_sets
search: product_name="Red Hat Virtualization Manager"
register: data
- name: "Output found repository sets, see the contentUrl section for possible repository substitutions"
debug:
var: data
- name: "Search for possible repository sets by label"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
resource: repository_sets
search: label=rhel-7-server-rhv-4.2-manager-rpms
register: data
- name: "Output found repository sets, see the contentUrl section for possible repository substitutions"
debug:
var: data
- name: Enable set with and without all_repositories at the same time
theforeman.foreman.repository_set:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
label: "{{ item.label }}"
repositories: "{{ item.repositories | default(omit) }}"
all_repositories: "{{ item.repositories is not defined }}"
state: enabled
loop:
- label: rhel-7-server-rpms
repositories:
- releasever: "7Server"
basearch: "x86_64"
- label: rhel-7-server-rhv-4.2-manager-rpms
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | |
---|---|---|---|
entity
dictionary
|
success |
Final state of the affected entities grouped by their type.
|
|
repository_sets
list
/ elements=dictionary
|
success |
List of repository sets.
|
Authors¶
Andrew Kofink (@akofink)