Skip to content

package

The package module manages system packages. It automatically detects the host’s package manager.

package "nginx" state="present"
package "vim" state="present"
package "telnet" state="absent"
ParameterTypeDescription
(positional)stringPackage name
statestring"present" (install) or "absent" (remove)
ManagerDistributions
aptDebian, Ubuntu
dnfFedora, RHEL 8+
yumCentOS, RHEL 7
pacmanArch Linux
apkAlpine Linux
zypperopenSUSE

The package manager is detected automatically based on the target host’s OS.

The module checks if the package is already installed (or already absent) before acting. No action is taken if the current state matches the desired state.

step "Install web stack" {
package "nginx" state="present"
package "certbot" state="present"
package "curl" state="present"
}
step "Remove unused" {
package "telnet" state="absent"
}