knowledge/technology/tools/Ansible/modules/ansible.builtin.package.md

30 lines
986 B
Markdown
Raw Normal View History

2023-12-04 10:02:23 +00:00
# ansible.builtin.package
Generic OS package manager
## Parameter
| Parameter | Type | Default | Description |
| --------- | --------------------- | ------- | ------------------------------------------------ |
| **name** | string / required | - | Package name, or package specifier with version. |
| **state** | "absent"<br>"present" | - | Whether to install, or remove a package. |
| | | | |
## Examples
```yaml
- 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
```