ansible.builtin.pacman (v2.4.3.0-1) — module

Manage packages with I(pacman)

| "added in version" 1.0 of ansible.builtin"

Authors: Indrajit Raychaudhuri (@indrajitr), 'Aaron Bull Schaefer (@elasticdog)' <aaron@elasticdog.com>, Afterburn

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.4.3.0.post1

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Install package foo
- pacman:
    name: foo
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Upgrade package foo
- pacman:
    name: foo
    state: latest
    update_cache: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove packages foo and bar
- pacman:
    name: foo,bar
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Recursively remove package baz
- pacman:
    name: baz
    state: absent
    recurse: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Run the equivalent of "pacman -Sy" as a separate step
- pacman:
    update_cache: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Run the equivalent of "pacman -Su" as a separate step
- pacman:
    upgrade: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Run the equivalent of "pacman -Syu" as a separate step
- pacman:
    update_cache: yes
    upgrade: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Run the equivalent of "pacman -Rdd", force remove package baz
- pacman:
    name: baz
    state: absent
    force: yes

Inputs

    
name:
    aliases:
    - pkg
    - package
    default: null
    description:
    - Name of the package to install, upgrade, or remove.
    required: false

force:
    choices:
    - 'yes'
    - 'no'
    default: false
    description:
    - When removing package - force remove package, without any checks. When update_cache
      - force redownload repo databases.
    required: false
    version_added: '2.0'
    version_added_collection: ansible.builtin

state:
    choices:
    - present
    - absent
    - latest
    default: present
    description:
    - Desired state of the package.
    required: false

recurse:
    choices:
    - 'yes'
    - 'no'
    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.
    required: false
    version_added: '1.3'
    version_added_collection: ansible.builtin

upgrade:
    choices:
    - 'yes'
    - 'no'
    default: false
    description:
    - Whether or not to upgrade whole system
    required: false
    version_added: '2.0'
    version_added_collection: ansible.builtin

update_cache:
    aliases:
    - update-cache
    choices:
    - 'yes'
    - 'no'
    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.
    required: false

Outputs

packages:
  description: a list of packages that have been changed
  returned: when upgrade is set to yes
  sample:
  - package
  - other-package
  type: list