jm1.pkg.meta_pkg (2023.11.23) — module

Use meta packages to simplify maintenance of the OS package manager.

Authors: Jakob Meng (@jm1)

preview | supported by community

Install collection

Install with ansible-galaxy collection install jm1.pkg:==2023.11.23


Add to requirements.yml

  collections:
    - name: jm1.pkg
      version: 2023.11.23

Description

This module allows to build, install and remove meta packages easily. Meta packages simplify the installation and removal of packages, using the OS package manager. A meta package does not ship nor manipulate any file or directory. It defines relationships between packages only [1][2], e.g. dependencies or conflicts. When a meta package is installed, the OS package manager will install or remove packages automatically to satisfy all relationships declared by the meta package. On systems that use dpkg (apt), such as Debian, Ubuntu and their derivatives, dependend packages will be marked as automatically installed. As soon as the meta package has been removed, all automatically installed packages will be removed as well. On systems that use dnf or an up-to-date yum, such as Fedora or CentOS, one might use 'dnf autoremove' or 'yum autoremove' to trigger the same autoremoving behaviour [2]. For example, a meta package helps with deploying an updated list of packages. Previously installed packages which have been removed from the updated list, will be uninstalled automatically by the OS package manager, once the new meta package version is rolled out. Ref.: [1] U(https://www.debian.org/doc/debian-policy/ch-relationships.html) [2] U(https://docs.fedoraproject.org/en-US/packaging-guidelines/) [3] U(https://dnf.readthedocs.io/en/latest/command_ref.html#autoremove-command-label)


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- jm1.pkg.meta_pkg:
    name: "developer-tools"
    depends:
    - make
    - gcc
    - git
    - vim
    conflicts:
    - clang

Inputs

    
name:
    description:
    - Meta package name.
    required: true
    type: str

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

depends:
    aliases:
    - requires
    default: []
    description:
    - Declares an absolute dependency, it is required for the software to function correctly.
    type: list

manager:
    choices:
    - auto
    - apt
    - dnf
    - yum
    default: auto
    description:
    - The package manager to use, e.g. apt or yum. The default C(auto) will use existing
      facts or try to autodetect it. You should only use this field if the automatic selection
      is not working for some reason.
    type: str

summary:
    aliases:
    - synopsis
    default: Meta package to simplify package management
    description:
    - A short and concise description of the package. The I(description) expands upon
      this.
    type: str

version:
    default: '1'
    description:
    - Meta package version.
    type: str

enhances:
    default: []
    description:
    - This field is similar to I(suggests) but works in the opposite direction. It is
      used to declare that a package can enhance the functionality of another package.
    type: list

suggests:
    default: []
    description:
    - Declare that one package may be more useful with one or more others. Using this
      field tells the packaging system and the user that the listed packages are related
      to this one and can perhaps enhance its usefulness, but that installing this one
      without them is perfectly reasonable. If the functionality should be available by
      default for users, I(recommends) should be used, and I(suggests) otherwise.
    type: list

conflicts:
    default: []
    description:
    - When a package declares a conflict with another using I(conflicts), the package
      manager will refuse to allow them to be installed or/and unpacked on the system
      at the same time.
    type: list

maintainer:
    aliases:
    - packager
    default: '{{Full Name}} <{{username}}@{{fqdn}}>'
    description:
    - "The package maintainer\u2019s name and email address. The name must come first,\
      \ then the email address inside angle brackets <> (in RFC822 format)."
    type: str

recommends:
    default: []
    description:
    - Declares a strong, but not absolute, dependency. The I(recommends) field should
      list packages that would be found together with this one in all but unusual installations.
      If the functionality should be available by default for users, I(recommends) should
      be used, and I(suggests) otherwise.
    type: list

description:
    default: Package management made easy.
    description:
    - 'Contains an extended description of the meta package. The description should describe
      the meta package to a user (system administrator) who has never met it before so
      that they have enough information to decide whether they want to install it. Beware:
      Distributions based on both, apt (deb) and yum/dnf (rpm) do place several restrictions
      on the I(description) field. For example, the I(description) must not contain tabs
      and no lines longer than 80 characters. Details in U(https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-description)
      and U(https://docs.fedoraproject.org/en-US/packaging-guidelines/#_summary_and_description).'
    type: str

architecture:
    aliases:
    - buildarch
    default: all or noarch
    description:
    - Architecture specification string, e.g. C(all) for Debian or C(noarch) for Fedora.
    type: str

Outputs

conflicts:
  description: List of conflicting packages after wildcard expansion
  returned: changed or success
  sample:
  - clang
  type: list
depends:
  description: List of required packages after wildcard expansion
  returned: changed or success
  sample:
  - make
  - gcc
  - git
  - vim
  type: list
enhances:
  description: List of enhanced packages after wildcard expansion
  returned: changed or success
  sample: []
  type: list
maintainer:
  description: "The package maintainer\u2019s name and email address"
  returned: changed or success
  sample: Jakob Meng <jakobmeng@web.de
  type: str
manager:
  description: The package manager that is used effectively
  returned: changed or success
  sample: apt
  type: str
recommends:
  description: List of recommended packages after wildcard expansion
  returned: changed or success
  sample: []
  type: list
suggests:
  description: List of suggested packages after wildcard expansion
  returned: changed or success
  sample: []
  type: list