ansible.builtin.package – Generic OS package manager¶
Note
This module is part of ansible-base
and included in all Ansible
installations. In most cases, you can use the short module name
package even without specifying the collections:
keyword.
Despite that, we recommend you use the FQCN for easy linking to the module
documentation and to avoid conflicting with other collections that may have
the same module name.
New in version 2.0: of ansible.builtin
Synopsis¶
Installs, upgrade and removes packages using the underlying OS package manager.
For Windows targets, use the ansible.windows.win_package module instead.
Note
This module has a corresponding action plugin.
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¶
Notes¶
Note
This module actually calls the pertinent package modules for each system (apt, yum, etc).
For Windows targets, use the ansible.windows.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
- name: Install the latest version of Apache and MariaDB
package:
name:
- httpd
- mariadb-server
state: latest
Authors¶
Ansible Core Team