ansible / ansible.builtin / v2.9.7 / module / pacman Manage packages with I(pacman) | "added in version" 1.0 of ansible.builtin" Authors: Indrajit Raychaudhuri (@indrajitr), Aaron Bull Schaefer (@elasticdog) <aaron@elasticdog.com>, Maxime de Roucy (@tchernomax) preview | supported by communityansible.builtin.pacman (v2.9.7) — module
pip
Install with pip install ansible==2.9.7
Manage packages with the I(pacman) package manager, which is used by Arch Linux and its variants.
- name: Install package foo from repo pacman: name: foo state: present
- name: Install package bar from file pacman: name: ~/bar-1.0-1-any.pkg.tar.xz state: present
- name: Install package foo from repo and bar from file pacman: name: - foo - ~/bar-1.0-1-any.pkg.tar.xz state: present
- name: Upgrade package foo pacman: name: foo state: latest update_cache: yes
- name: Remove packages foo and bar pacman: name: - foo - bar state: absent
- name: Recursively remove package baz pacman: name: baz state: absent extra_args: --recursive
- name: Run the equivalent of "pacman -Sy" as a separate step pacman: update_cache: yes
- name: Run the equivalent of "pacman -Su" as a separate step pacman: upgrade: yes
- name: Run the equivalent of "pacman -Syu" as a separate step pacman: update_cache: yes upgrade: yes
- name: Run the equivalent of "pacman -Rdd", force remove package baz pacman: name: baz state: absent force: yes
name: aliases: - package - pkg description: - Name or list of names of the package(s) or file(s) to install, upgrade, or remove. Can't be used in combination with C(upgrade). force: default: false description: - When removing package, force remove package, without any checks. Same as `extra_args="--nodeps --nodeps"`. When update_cache, force redownload repo databases. Same as `update_cache_extra_args="--refresh --refresh"`. type: bool version_added: '2.0' version_added_collection: ansible.builtin state: choices: - absent - latest - present default: present description: - Desired state of the package. recurse: default: false description: - When removing a package, also remove its dependencies, provided that they are not required by other packages and were not explicitly installed by a user. This option is deprecated since 2.8 and will be removed in 2.10, use `extra_args=--recursive`. type: bool version_added: '1.3' version_added_collection: ansible.builtin upgrade: default: false description: - Whether or not to upgrade the whole system. Can't be used in combination with C(name). type: bool version_added: '2.0' version_added_collection: ansible.builtin extra_args: default: null description: - Additional option to pass to pacman when enforcing C(state). version_added: '2.8' version_added_collection: ansible.builtin update_cache: aliases: - update-cache default: false description: - Whether or not to refresh the master package lists. - This can be run as part of a package installation or as a separate step. type: bool upgrade_extra_args: default: null description: - Additional option to pass to pacman when enforcing C(upgrade). version_added: '2.8' version_added_collection: ansible.builtin update_cache_extra_args: default: null description: - Additional option to pass to pacman when enforcing C(update_cache). version_added: '2.8' version_added_collection: ansible.builtin
packages: description: a list of packages that have been changed returned: when upgrade is set to yes sample: - package - other-package type: list