pacman – Manage packages with pacman

From Get docs
Ansible/docs/2.7/modules/pacman module


pacman – Manage packages with pacman

Synopsis

  • Manage packages with the pacman package manager, which is used by Arch Linux and its variants.

Parameters

Parameter Choices/Defaults Comments

force

boolean

added in 2.0

  • no

  • yes

When removing package - force remove package, without any checks. When update_cache - force redownload repo databases.

name

-

Name or list of names of the packages to install, upgrade, or remove.


aliases: package, pkg

recurse

boolean

added in 1.3

  • no

  • yes

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.

state

-

  • absent
  • latest
  • present

Desired state of the package.

update_cache

boolean

  • no

  • yes

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

upgrade

boolean

added in 2.0

  • no

  • yes

Whether or not to upgrade whole system.



Notes

Note

  • When used with a loop: each package will be processed individually, it is much more efficient to pass the list directly to the name option.


Examples

- name: Install package foo
  pacman:
    name: foo
    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
    recurse: yes

- 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

Return Values

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']




Status

Authors

  • Indrajit Raychaudhuri (@indrajitr)
  • Aaron Bull Schaefer (@elasticdog) <[email protected]>
  • Afterburn

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.7/modules/pacman_module.html