arillso.agent.apt_version_pin filter – Resolve an apt version pin from apt-cache madison output
Note
This filter plugin is part of the arillso.agent collection (version 2.1.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.agent.
To use it in a playbook, specify: arillso.agent.apt_version_pin.
New in arillso.agent 2.1.0
Synopsis
Picks the full apt version string for an upstream version out of
apt-cache madisonoutput.apt matches an
=pin against the full version string and does not expand globs in it. Grafana publishes1.21.3-1for alloy 1.21.3, while Tailscale and DigitalOcean publish the bare1.104.4and3.18.16, so the exact string has to be looked up on the host.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.agent.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.agent.apt_version_pin(key1=value1, key2=value2, ...)
Parameter |
Comments |
|---|---|
The upstream version to resolve, for example Matched when it opens the string or follows an epoch colon, and is followed by the end of the string or a
|
Examples
- name: Look up the versions the apt repository offers
ansible.builtin.command:
cmd: apt-cache madison alloy
register: alloy_madison
changed_when: false
- name: Resolve the full apt version string
ansible.builtin.set_fact:
alloy_apt_version: "{{ alloy_madison.stdout_lines | arillso.agent.apt_version_pin('1.21.3') }}"
# Returns 1.21.3-1, or None when the repository no longer carries the version.
Return Value
Key |
Description |
|---|---|
The full apt version string, epoch and revision included.
Returned: success |