package – Generic OS package manager — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# package – Generic OS package manager

New in version 2.0.

- Synopsis
- Requirements
- Parameters
- Notes
- Examples
- Status

## Synopsis

- Installs, upgrade and removes packages using the underlying OS package manager.
- For Windows targets, use the win_package module instead.

## Requirements

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

- Whatever is required for the package plugins specific for each system.

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
name - / required |  | Package name, or package specifier with version, like `name-1.0`. Be aware that packages are not always named the same and this module will not 'translate' them per distro.
state - / required |  | Whether to install (`present`), or remove (`absent`) a package. Other states depend on the underlying package module, i.e `latest`.
use - | Default: "auto" | The required package manager module to use (yum, apt, etc). The default 'auto' will use existing facts or try to autodetect it. You should only use this field if the automatic selection is not working for some reason.

## Notes

Note

- This module actually calls the pertinent package modules for each system (apt, yum, etc).
- For Windows targets, use the win_package module instead.

## Examples

    - name: install ntpdate
      package:
        name: ntpdate
        state: present

    # This uses a variable as this changes per distribution.
    - name: remove the apache package
      package:
        name: "{{ apache }}"
        state: absent

## Status

- This module is guaranteed to have no backward incompatible interface changes going forward. [stableinterface]
- This module is maintained by the Ansible Core Team. [core]

### Red Hat Support

More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.

### Authors

- Ansible Core Team

Hint

If you notice any issues in this documentation you can edit this document to improve it.