Skip to content

Commit 2b8df28

Browse files
authored
Merge pull request #3590 from nickanderson/ENT-11784/3.24
ENT-11784: Added dnf package module documentation
2 parents 9444e5a + d3f8310 commit 2b8df28

1 file changed

Lines changed: 73 additions & 2 deletions

File tree

reference/promise-types/packages.markdown

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ packages:
374374

375375
Enable a specific repository for a specific promise.
376376

377-
```cf3
377+
```cf3 {skip TODO}
378378
bundle agent example
379379
{
380380
packages:
@@ -394,7 +394,7 @@ bundle agent example
394394
"httpd"
395395
policy => "present",
396396
version => "latest",
397-
options => { "disablerepo=* enablerepo=UPDATES" };
397+
options => { "disablerepo=*", "enablerepo=UPDATES" };
398398
}
399399
```
400400

@@ -446,6 +446,77 @@ bundle agent example
446446
* Added in CFEngine 3.7.0
447447
* `enablerepo` and `disablerepo` option support added in 3.7.8, 3.10.4, 3.12.0
448448

449+
### dnf
450+
451+
Manage packages using `dnf`. This is the [default package module][lib/packages.cf#package_module_knowledge] for modern Red Hat, CentOS, Fedora, and Amazon Linux systems.
452+
453+
**Examples:**
454+
455+
File based package source.
456+
457+
```cf3 {skip TODO}
458+
packages:
459+
redhat|centos|amazon_linux::
460+
"/mnt/nfs/packages/httpd-2.4.37-65.module+el8.10.0+40053+5a18018e.7.x86_64.rpm"
461+
policy => "present";
462+
```
463+
464+
Repository based package source with a specific version of the package.
465+
466+
```cf3 {skip TODO}
467+
packages:
468+
(redhat|centos|amazon_linux).workstation::
469+
"emacs"
470+
policy => "present",
471+
version => "26.1-13";
472+
```
473+
474+
Enable a specific repository for a specific promise.
475+
476+
```cf3
477+
bundle agent example
478+
{
479+
packages:
480+
481+
rocky_8::
482+
# Enable the EPEL repo when making sure etc-keeper is installed
483+
# and up to date.
484+
485+
"etckeeper-dnf"
486+
policy => "present",
487+
version => "latest",
488+
options => { "enablerepo=powertools" };
489+
490+
# Only consider updates from the main repositories for
491+
# httpd and disable all other repositories
492+
493+
"httpd"
494+
policy => "present",
495+
version => "latest",
496+
options => { "disablerepo=*", "enablerepo=UPDATES" };
497+
}
498+
```
499+
500+
**Notes:**
501+
502+
- Supports file path and repository sourced packages.
503+
504+
- Requires Python 3 to be installed on the host (leverages cfengine-selected-python).
505+
506+
- Package downgrades default to the system configuration (typically disabled). To explicitly allow the module to downgrade a package for a specific promise, set `options => { "allow_downgrade=true" }`.
507+
508+
```cf3 {skip TODO}
509+
packages:
510+
"httpd"
511+
policy => "present",
512+
version => "2.4.37-64", # Older version
513+
options => { "allow_downgrade=true" };
514+
```
515+
516+
**History:**
517+
518+
- Added in CFEngine 3.28.0, 3.27.1, 3.24.4
519+
449520
### apt_get
450521

451522
Manage packages using ```apt-get```.

0 commit comments

Comments
 (0)