knowledge/technology/tools/Ansible/modules/ansible.builtin.package.md
2023-12-04 11:02:23 +01:00

986 B

ansible.builtin.package

Generic OS package manager

Parameter

Parameter Type Default Description
name string / required - Package name, or package specifier with version.
state "absent"
"present"
- Whether to install, or remove a package.

Examples

- name: Install ntpdate
  ansible.builtin.package:
    name: ntpdate
    state: present

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

- name: Install the latest version of Apache and MariaDB
  ansible.builtin.package:
    name:
      - httpd
      - mariadb-server
    state: latest