arillso.system.github_latest_release lookup – Get the latest tagged release version from a public Github repository.

Note

This lookup plugin is part of the arillso.system collection (version 0.0.34).

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.system. You need further requirements to be able to use this lookup plugin, see Requirements for details.

To use it in a playbook, specify: arillso.system.github_latest_release.

New in arillso.system 2.9

Synopsis

  • This lookup returns the latest tagged release version of a public Github repository.

  • A future version will accept an optional Github token to allow lookup of private repositories.

Requirements

The below requirements are needed on the local controller node that executes this lookup.

  • json

  • re

Keyword parameters

This describes keyword parameters of the lookup. These are the values key1=value1, key2=value2 and so on in the following examples: lookup('arillso.system.github_latest_release', key1=value1, key2=value2, ...) and query('arillso.system.github_latest_release', key1=value1, key2=value2, ...)

Parameter

Comments

repos

string / required

A list of Github repositories from which to retrieve versions.

Notes

Note

  • The version tag is returned however it is defined by the Github repository.

  • Most repositories used the convention ‘vX.X.X’ for a tag, while some use ‘X.X.X’.

  • Some may use release tagging structures other than semver.

  • This plugin does not perform opinionated formatting of the release tag structure.

  • Users should format the value via filters after calling this plugin, if needed.

See Also

See also

Github Releases API

API documentation for retrieving the latest version of a release.

Examples

- name: Strip the 'v' out of the tag version, e.g. 'v1.0.0' -> '1.0.0'
  set_fact:
    ansible_version: "{{ lookup('arillso.system.github_latest_release', 'ansible/ansible')[1:] }}"

- name: Operate on multiple repositories
  git:
    repo: https://github.com/{{ item }}.git
    version: "{{ lookup('arillso.system.github_latest_release', item) }}"
    dest: "{{ lookup('env', 'HOME') }}/projects"
  with_items:
    - ansible/ansible
    - ansible/molecule
    - ansible/awx

Return Value

Key

Description

Return value

list / elements=string

List of latest Github repository version(s)

Returned: success

Authors

  • arillso (@arillso)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.