zester
GuidesModules

pkg.removed

Ensures that a system package is not installed. Inverse of pkg.installed.

Uses the same package provider as pkg.installed (apt, dnf, yum, brew), selected at peel startup based on OS family.


Parameters

ParameterTypeDefaultDescription
namestringstate IDName of the package to remove

Example

# Remove using the state ID as the package name.
wget:
  pkg.removed: []

# Remove using an explicit name.
remove-old-client:
  pkg.removed:
    - name: curl
    - require:
      - "cmd.run:stop-service"

Behavior

PhaseAction
CheckIsInstalled — returns NeedsChange: true if the package is installed
ApplyRemove — uninstalls the package via the package manager
RevertInstall — reinstalls the package (empty version string installs latest)

Notes

  • Revert reinstalls the package without a version constraint. If you need to pin a version on revert, use pkg.installed as the desired end state instead.
  • The module reports NeedsChange: false (already correct) when the package is not installed, making it safe to run repeatedly.
  • Use require to ensure dependent services are stopped before removal.

On this page