community.general.apt_rpm (8.5.0) — module

APT-RPM package manager

Authors: Evgenii Terechkov (@evgkrsk)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install package foo
  community.general.apt_rpm:
    pkg: foo
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install packages foo and bar
  community.general.apt_rpm:
    pkg:
      - foo
      - bar
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove package foo
  community.general.apt_rpm:
    pkg: foo
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove packages foo and bar
  community.general.apt_rpm:
    pkg: foo,bar
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Run the equivalent of "apt-get clean" as a separate step
  community.general.apt_rpm:
    clean: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Perform cache update and complete system upgrade (includes kernel)
  community.general.apt_rpm:
    update_cache: true
    dist_upgrade: true
    update_kernel: true

Inputs

    
clean:
    default: false
    description:
    - Run the equivalent of C(apt-get clean) to clear out the local repository of retrieved
      package files. It removes everything but the lock file from C(/var/cache/apt/archives/)
      and C(/var/cache/apt/archives/partial/).
    - Can be run as part of the package installation (clean runs before install) or as
      a separate step.
    type: bool
    version_added: 6.5.0
    version_added_collection: community.general

state:
    choices:
    - absent
    - present
    - installed
    - removed
    default: present
    description:
    - Indicates the desired package state.
    type: str

package:
    aliases:
    - name
    - pkg
    description:
    - List of packages to install, upgrade, or remove.
    - Since community.general 8.0.0, may include paths to local C(.rpm) files if O(state=installed)
      or O(state=present), requires C(rpm) python module.
    elements: str
    type: list

dist_upgrade:
    default: false
    description:
    - If true performs an C(apt-get dist-upgrade) to upgrade system.
    type: bool
    version_added: 6.5.0
    version_added_collection: community.general

update_cache:
    default: false
    description:
    - Run the equivalent of C(apt-get update) before the operation. Can be run as part
      of the package installation or as a separate step.
    - Default is not to update the cache.
    type: bool

update_kernel:
    default: false
    description:
    - If true performs an C(update-kernel) to upgrade kernel packages.
    type: bool
    version_added: 6.5.0
    version_added_collection: community.general