community / community.general / 3.8.10 / module / pacman Manage packages with I(pacman) Authors: Indrajit Raychaudhuri (@indrajitr), Aaron Bull Schaefer (@elasticdog) <aaron@elasticdog.com>, Maxime de Roucy (@tchernomax)community.general.pacman (3.8.10) — module
Install with ansible-galaxy collection install community.general:==3.8.10
collections: - name: community.general version: 3.8.10
Manage packages with the I(pacman) package manager, which is used by Arch Linux and its variants.
- name: Install package foo from repo community.general.pacman: name: foo state: present
- name: Install package bar from file community.general.pacman: name: ~/bar-1.0-1-any.pkg.tar.xz state: present
- name: Install package foo from repo and bar from file community.general.pacman: name: - foo - ~/bar-1.0-1-any.pkg.tar.xz state: present
- name: Install package from AUR using a Pacman compatible AUR helper community.general.pacman: name: foo state: present executable: yay extra_args: --builddir /var/cache/yay
- name: Upgrade package foo community.general.pacman: name: foo state: latest update_cache: yes
- name: Remove packages foo and bar community.general.pacman: name: - foo - bar state: absent
- name: Recursively remove package baz community.general.pacman: name: baz state: absent extra_args: --recursive
- name: Run the equivalent of "pacman -Sy" as a separate step community.general.pacman: update_cache: yes
- name: Run the equivalent of "pacman -Su" as a separate step community.general.pacman: upgrade: yes
- name: Run the equivalent of "pacman -Syu" as a separate step community.general.pacman: update_cache: yes upgrade: yes
- name: Run the equivalent of "pacman -Rdd", force remove package baz community.general.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). elements: str type: list 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 state: choices: - absent - installed - latest - present - removed default: present description: - Whether to install (C(present) or C(installed), C(latest)), or remove (C(absent) or C(removed)) a package. - C(present) and C(installed) will simply ensure that a desired package is installed. - C(latest) will update the specified package if it is not of the latest available version. - C(absent) and C(removed) will remove the specified package. type: str upgrade: default: false description: - Whether or not to upgrade the whole system. Can't be used in combination with C(name). type: bool executable: default: pacman description: - Name of binary to use. This can either be C(pacman) or a pacman compatible AUR helper. - Beware that AUR helpers might behave unexpectedly and are therefore not recommended. type: str version_added: 3.1.0 version_added_collection: community.general extra_args: default: null description: - Additional option to pass to pacman when enforcing C(state). type: str 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. - Alias C(update-cache) has been deprecated and will be removed in community.general 5.0.0. type: bool upgrade_extra_args: default: null description: - Additional option to pass to pacman when enforcing C(upgrade). type: str update_cache_extra_args: default: null description: - Additional option to pass to pacman when enforcing C(update_cache). type: str
packages: description: a list of packages that have been changed returned: when upgrade is set to yes sample: - package - other-package type: list