arillso.container.apt_version_pin filter – Resolve an apt version pin from apt-cache madison output
Note
This filter plugin is part of the arillso.container collection (version 2.0.0).
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 arillso.container.
To use it in a playbook, specify: arillso.container.apt_version_pin.
New in arillso.container 2.0.0
Synopsis
Picks the full apt version string for a marketing version out of
apt-cache madisonoutput.apt matches an
=pin against the full version string, which carries an optional epoch and a distro release suffix, and it does not expand globs in that pin.A bare pin such as
docker-ce=29.7.2therefore never resolves, and neither doesdocker-ce=*29.7.2-*; only the string madison prints does.Returns
Nonewhen the version is not in the repository, so the calling task can fail with a readable message instead of a Python traceback.
Input
This describes the input of the filter, the value before | arillso.container.apt_version_pin.
Parameter |
Comments |
|---|---|
Lines of Each line looks like |
Keyword parameters
This describes keyword parameters of the filter. These are the values key1=value1, key2=value2 and so on in the following
example: input | arillso.container.apt_version_pin(key1=value1, key2=value2, ...)
Parameter |
Comments |
|---|---|
The marketing version to resolve, for example Matched on Dots are matched literally, so |
Notes
Note
The filter never raises on a missing version; the readable error belongs in an
ansible.builtin.failtask.
Examples
# Resolve the exact apt version string before pinning it
- name: Resolve the apt version string for the pin
ansible.builtin.command:
cmd: apt-cache madison docker-compose-plugin
register: compose_madison
changed_when: false
- name: Set the resolved apt version string
ansible.builtin.set_fact:
docker_compose_v2_apt_version: >-
{{ compose_madison.stdout_lines
| arillso.container.apt_version_pin(docker_compose_v2_version) }}
# Returns e.g. 5.4.0-1~ubuntu.24.04~noble, or None when the repository
# no longer carries the version.
Return Value
Key |
Description |
|---|---|
The full apt version string, epoch and distro suffix included.
Returned: success |