W3cubDocs

/Ansible

pacman - Manage packages with pacman

Synopsis

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

Options

parameter required default choices comments
force
(added in 2.0)
no
  • yes
  • no
When removing package - force remove package, without any checks. When update_cache - force redownload repo databases.
name
no
Name of the package to install, upgrade, or remove.
aliases: pkg, package
recurse
(added in 1.3)
no
  • yes
  • no
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
no present
  • present
  • absent
  • latest
Desired state of the package.
update_cache
no
  • yes
  • no
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
(added in 2.0)
no
  • yes
  • no
Whether or not to upgrade whole system

Examples

# Install package foo
- pacman: name=foo state=present

# Upgrade package foo
- pacman: name=foo state=latest update_cache=yes

# Remove packages foo and bar
- pacman: name=foo,bar state=absent

# Recursively remove package baz
- pacman: name=baz state=absent recurse=yes

# Run the equivalent of "pacman -Sy" as a separate step
- pacman: update_cache=yes

# Run the equivalent of "pacman -Su" as a separate step
- pacman: upgrade=yes

# Run the equivalent of "pacman -Syu" as a separate step
- pacman: update_cache=yes upgrade=yes

# Run the equivalent of "pacman -Rdd", force remove package baz
- pacman: name=baz state=absent force=yes

This is an Extras Module

For more information on what this means please read Extras Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/pacman_module.html