theforeman.foreman.repository – Manage Repositories

Note

This plugin is part of the theforeman.foreman collection (version 2.1.2).

To install it use: ansible-galaxy collection install theforeman.foreman.

To use it in a playbook, specify: theforeman.foreman.repository.

New in version 1.0.0: of theforeman.foreman

Synopsis

  • Create and manage repositories

Requirements

The below requirements are needed on the host that executes this module.

  • requests

Parameters

Parameter Choices/Defaults Comments
ansible_collection_requirements
string
Contents of requirement yaml file to sync from URL
auto_enabled
boolean
    Choices:
  • no
  • yes
repositories will be automatically enabled on a registered host subscribed to this product
checksum_type
string
    Choices:
  • sha1
  • sha256
Checksum of the repository
content_type
string / required
    Choices:
  • deb
  • docker
  • file
  • ostree
  • puppet
  • yum
  • ansible_collection
The content type of the repository
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
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
docker_upstream_name
string
name of the upstream docker repository
only available for content_type=docker
download_policy
string
    Choices:
  • background
  • immediate
  • on_demand
download policy for sync from upstream
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
    Choices:
  • global_default_http_proxy
  • none
  • use_selected_http_proxy
Which proxy to use for content synching
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
    Choices:
  • no
  • yes
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
label
string
label of the repository
mirror_on_sync
boolean
    Choices:
  • no
  • yes ←
toggle "mirror on sync" where the state of the repository mirrors that of the upstream repository at sync time
name
string / required
Name of the repository
organization
string / required
Organization that the entity is in
password
string / required
Password of the user accessing the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_PASSWORD will be used instead.
product
string / required
Product to which the repository lives in
server_url
string / required
URL of the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_SERVER_URL will be used instead.
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
    Choices:
  • present ←
  • present_with_defaults
  • absent
State of the entity
present_with_defaults will ensure the entity exists, but won't update existing ones
unprotected
boolean
    Choices:
  • no
  • yes
publish the repository via HTTP
upstream_password
string
password to access upstream repository
upstream_username
string
username to access upstream repository
url
string
Repository URL to sync from
username
string / required
Username accessing the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_USERNAME will be used instead.
validate_certs
boolean
    Choices:
  • no
  • yes ←
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 FOREMAN_VALIDATE_CERTS will be used instead.
verify_ssl_on_sync
boolean
    Choices:
  • no
  • yes
verify the upstream certifcates are signed by a trusted CA

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: background

- 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: background
    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 Returned Description
entity
dictionary
success
Final state of the affected entities grouped by their type.

 
repositories
list / elements=dictionary
success
List of repositories.



Authors

  • Eric D Helms (@ehelms)