community.general.dnf_config_manager module – Enable or disable dnf repositories using config-manager

Note

This module is part of the community.general collection (version 9.4.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 community.general. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.general.dnf_config_manager.

New in community.general 8.2.0

Synopsis

  • This module enables or disables repositories using the dnf config-manager sub-command.

Requirements

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

  • dnf

  • dnf-plugins-core

Parameters

Parameter

Comments

name

list / elements=string

Repository ID, for example crb.

Default: []

state

string

Whether the repositories should be enabled or disabled.

Choices:

  • "enabled" ← (default)

  • "disabled"

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

See Also

See also

ansible.builtin.dnf

Manages packages with the dnf package manager.

ansible.builtin.yum_repository

Add or remove YUM repositories.

Examples

- name: Ensure the crb repository is enabled
  community.general.dnf_config_manager:
    name: crb
    state: enabled

- name: Ensure the appstream and zfs repositories are disabled
  community.general.dnf_config_manager:
    name:
      - appstream
      - zfs
    state: disabled

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

changed_repos

list / elements=string

Repositories changed.

Returned: success

Sample: ["crb"]

repo_states_post

dictionary

Repository states after action taken.

Returned: success

Sample: {"disabled": ["appstream-debuginfo", "appstream-source", "baseos-debuginfo", "baseos-source", "crb-debug", "crb-source"], "enabled": ["appstream", "baseos", "crb"]}

disabled

list / elements=string

Disabled repository IDs.

Returned: success

enabled

list / elements=string

Enabled repository IDs.

Returned: success

repo_states_pre

dictionary

Repo IDs before action taken.

Returned: success

Sample: {"disabled": ["appstream-debuginfo", "appstream-source", "baseos-debuginfo", "baseos-source", "crb-debug", "crb-source"], "enabled": ["appstream", "baseos", "crb"]}

disabled

list / elements=string

Disabled repository IDs.

Returned: success

enabled

list / elements=string

Enabled repository IDs.

Returned: success

Authors

  • Andrew Hyatt (@ahyattdev)