Documentation
PLEASE NOTE: This document applies to v2.18 version and not to the latest stable release v2.19
Documentation for other releases can be found by using the version selector in the top right of any doc page.dnf
Manage packages with the dnf package manager, which is used by Fedora and RHEL.
Attributes
check_mode:
support: full
Parameters
| Parameter | Required | Type | Values | Description |
|---|---|---|---|---|
| disable_gpg_check | boolean | Disable all repositories. [default: false] |
||
| disablerepo | string | Disable a specific repository. | ||
| enablerepo | string | Enable a specific repository. | ||
| executable | string | Path of the binary to use. [default: "dnf"] |
||
| extra_args | string | Additional options to pass to dnf. | ||
| name | array | Name or list of names of the package(s) to install, upgrade, or remove. | ||
| skip_broken | boolean | Skip packages with broken dependencies. [default: false] |
||
| state | string | absent present latest removed installed |
Whether to install (present/installed), remove (absent/removed), or ensure latest version (latest). present and installed will simply ensure that a desired package is installed. absent and removed will remove the specified package. latest will update the specified package to the latest version. [default: "present"] |
|
| update_cache | boolean | Whether or not to refresh the package index. [default: false] |
Example
- name: Update package cache
dnf:
update_cache: yes
- name: Install packages
dnf:
name:
- nginx
- postgresql-server
state: present
- name: Install specific version
dnf:
name: nginx-1.24.0
state: present
- name: Remove package
dnf:
name: vim
state: absent
- name: Install package from specific repo
dnf:
name: nginx
enablerepo: epel
state: present