theforeman.foreman.repository module – Manage Repositories
Note
This module is part of the theforeman.foreman collection (version 5.11.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install theforeman.foreman. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: theforeman.foreman.repository.
New in theforeman.foreman 1.0.0
Synopsis
- Create and manage repositories
Aliases: katello_repository
Requirements
The below requirements are needed on the host that executes this module.
- requests
Parameters
Parameter | Comments |
|---|---|
ansible_collection_auth_token string added in theforeman.foreman 5.5.0 | The token key to use for authentication. |
ansible_collection_auth_url string added in theforeman.foreman 5.5.0 | The URL to receive a session token from, e.g. used with Automation Hub. |
ansible_collection_requirements string | Contents of requirement yaml file to sync from URL |
arch string | Architecture of content in the repository Set to |
auto_enabled boolean | repositories will be automatically enabled on a registered host subscribed to this product Choices:
|
ca_path path | PEM formatted file that contains a CA certificate to be used for validation. If the value is not specified in the task, the value of environment variable |
checksum_type string | Checksum of the repository Choices:
|
content_type string / required | The content type of the repository Choices:
|
deb_architectures string | comma separated list of architectures to be synced from deb-archive only available for content_type=deb |
deb_components string | comma separated list of repo components to be synced from deb-archive only available for content_type=deb |
deb_errata_url string | URL to sync Debian or Ubuntu errata information from only available on Orcharhino only available for content_type=deb |
deb_releases string | comma separated list of releases to be synced from deb-archive only available for content_type=deb |
depth integer added in theforeman.foreman 5.5.0 | An option to specify how many ostree commits to traverse. |
description string | Description of the repository |
docker_tags_whitelist list / elements=string | list of tags to sync for Container Image repository only available for content_type=docker Deprecated since Katello 4.4 |
docker_upstream_name string | name of the upstream docker repository only available for content_type=docker |
download_concurrency integer added in theforeman.foreman 3.0.0 | download concurrency for sync from upstream as the API does not return this value, this will break idempotence for this module |
download_policy string | The download policy for sync from upstream. The download policy Choices:
|
exclude_refs list / elements=string added in theforeman.foreman 5.5.0 | List of tags to exclude during an ostree sync. The wildcards
|
exclude_tags list / elements=string added in theforeman.foreman 3.7.0 | List of tags to exclude when syncing a container image repository. |
excludes list / elements=string added in theforeman.foreman 5.5.0 | Python packages to exclude from the upstream URL. You may also specify versions, for example: |
gpg_key string | Repository GPG key |
http_proxy string | Name of the http proxy to use for content synching Should be combined with http_proxy_policy=’use_selected_http_proxy’ |
http_proxy_policy string | Which proxy to use for content synching Choices:
|
ignorable_content list / elements=string | List of content units to ignore while syncing a yum repository. Must be subset of rpm,drpm,srpm,distribution,erratum. |
ignore_global_proxy boolean | Whether content sync should use or ignore the global http proxy setting This is deprecated with Katello 3.13 It has been superseeded by http_proxy_policy Choices:
|
include_refs list / elements=string added in theforeman.foreman 5.5.0 | List of refs to include during an ostree sync. The wildcards |
include_tags list / elements=string added in theforeman.foreman 3.7.0 | List of tags to sync for a container image repository. |
includes list / elements=string added in theforeman.foreman 5.5.0 | Python packages to include from the upstream URL, You may also specify versions, for example: Leave empty to include every package. |
keep_latest_packages integer added in theforeman.foreman 5.5.0 | The amount of latest versions of a package to keep on sync, includes pre-releases if synced. Defaults to keep all versions. |
label string | label of the repository |
metadata_expire integer added in theforeman.foreman 5.4.0 | Set the metadata expiration time (in seconds) for a yum repository. |
mirror_on_sync boolean | toggle “mirror on sync” where the state of the repository mirrors that of the upstream repository at sync time This is deprecated with Katello 4.3 It has been superseeded by mirroring_policy=mirror_content_only Choices:
|
mirroring_policy string | Policy to set for mirroring content Supported since Katello 4.3 Choices:
|
name string / required | Name of the repository |
oauth1_consumer_key string | OAuth1 consumer key for accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
oauth1_consumer_secret string | OAuth1 consumer secret for accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
organization string / required | Organization that the entity is in |
os_versions list / elements=string | Identifies whether the repository should be disabled on a client with a non-matching OS version. A maximum of one OS version can be selected. Set to Choices:
|
package_types list / elements=string added in theforeman.foreman 5.5.0 | Package types to sync for Python content, separated by comma. FIXME Leave empty to get every package type. Choices:
|
password string | Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
product string / required | Product to which the repository lives in |
retain_package_versions_count integer added in theforeman.foreman 5.4.0 | The maximum number of versions of each package to keep. |
server_url string / required | URL of the Foreman server. If the value is not specified in the task, the value of environment variable |
ssl_ca_cert string | Repository SSL CA certificate |
ssl_client_cert string | Repository SSL client certificate |
ssl_client_key string | Repository SSL client private key |
state string | State of the entity
Choices:
|
unprotected boolean | publish the repository via HTTP Choices:
|
upstream_authentication_token string added in theforeman.foreman 5.5.0 | Upstream authentication token string for yum repositories. |
upstream_password string | Password to access upstream repository. When this parameter is set, the module will not be idempotent. |
upstream_username string | username to access upstream repository |
url string | Repository URL to sync from |
use_gssapi boolean | Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. Requires the Python library requests-gssapi to be installed. If the value is not specified in the task, the value of environment variable Choices:
|
username string | Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
validate_certs boolean | Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable Choices:
|
verify_ssl_on_sync boolean | verify the upstream certifcates are signed by a trusted CA Choices:
|
Attributes
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full | Can run in check_mode and return changed status prediction without modifying the entity |
diff_mode | Support: full | Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode |
Notes
Note
- You can configure certain aspects of existing Red Hat Repositories (like download_policy) using this module, but you can’t create (enable) or delete (disable) them.
- If you want to enable or disable Red Hat Repositories available through your subscription, please use the theforeman.foreman.repository_set module instead.
Examples
- name: "Create repository"
theforeman.foreman.repository:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My repository"
state: present
content_type: "yum"
product: "My Product"
organization: "Default Organization"
url: "http://yum.theforeman.org/plugins/latest/el7/x86_64/"
mirror_on_sync: true
download_policy: immediate
- name: "Create repository with content credentials"
theforeman.foreman.repository:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
name: "My repository 2"
state: present
content_type: "yum"
product: "My Product"
organization: "Default Organization"
url: "http://yum.theforeman.org/releases/latest/el7/x86_64/"
download_policy: on_demand
mirror_on_sync: true
gpg_key: RPM-GPG-KEY-my-product2
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
entity dictionary | Final state of the affected entities grouped by their type. Returned: success |
|
repositories list / elements=dictionary |
List of repositories. Returned: success |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/theforeman/foreman/repository_module.html