Parameter | Choices/Defaults | Comments |
---|---|---|
extra_args - added in 2.8 | Default: null | Additional option to pass to pacman when enforcing state . |
force boolean |
| 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"`. |
name - | Name or list of names of the package(s) or file(s) to install, upgrade, or remove. Can't be used in combination with upgrade .aliases: package, pkg | |
recurse boolean |
| 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`. |
state - |
| Desired state of the package. |
update_cache boolean |
| Whether or not to refresh the master package lists. This can be run as part of a package installation or as a separate step. aliases: update-cache |
update_cache_extra_args - added in 2.8 | Default: null | Additional option to pass to pacman when enforcing update_cache . |
upgrade boolean |
| Whether or not to upgrade the whole system. Can't be used in combination with name . |
upgrade_extra_args - added in 2.8 | Default: null | Additional option to pass to pacman when enforcing upgrade . |
Note
loop:
each package will be processed individually, it is much more efficient to pass the list directly to the name
option.- 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
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
packages list | when upgrade is set to yes | a list of packages that have been changed Sample: ['package', 'other-package'] |
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/pacman_module.html