community.general.apt_rpm module – apt_rpm package manager

Note

This module is part of the community.general collection (version 4.8.3).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.apt_rpm.

Synopsis

  • Manages packages with apt-rpm. Both low-level (rpm) and high-level (apt-get) package manager binaries required.

Parameters

Parameter

Comments

package

aliases: name, pkg

list / elements=string / required

list of packages to install, upgrade or remove.

state

string

Indicates the desired package state.

Choices:

  • absent

  • present ← (default)

  • installed

  • removed

update_cache

aliases: update-cache

boolean

update the package database first apt-get update.

Alias update-cache has been deprecated and will be removed in community.general 5.0.0.

Choices:

  • no ← (default)

  • yes

Examples

- name: Install package foo
  community.general.apt_rpm:
    pkg: foo
    state: present

- name: Install packages foo and bar
  community.general.apt_rpm:
    pkg:
      - foo
      - bar
    state: present

- name: Remove package foo
  community.general.apt_rpm:
    pkg: foo
    state: absent

- name: Remove packages foo and bar
  community.general.apt_rpm:
    pkg: foo,bar
    state: absent

# bar will be the updated if a newer version exists
- name: Update the package database and install bar
  community.general.apt_rpm:
    name: bar
    state: present
    update_cache: yes

Authors

  • Evgenii Terechkov (@evgkrsk)