Ansible role supports setting besu_version=='latest' and role discover the latest released version from the GitHub repository. Since the besu_version may be set via command line, this variable cannot be updated using the set_fact. Introduced a new variable _besu_version which is updated to either value of besu_version or latest version discovered Signed-off-by: Chaminda Divitotawela <cdivitotawela@gmail.com>besu-latest-version
parent
857d4a8d54
commit
97e484151d
@ -0,0 +1,19 @@ |
|||||||
|
- name: Get the version response |
||||||
|
ansible.builtin.uri: |
||||||
|
url: "{{ besu_latest_version_url }}" |
||||||
|
method: GET |
||||||
|
status_code: 200 |
||||||
|
register: _besu_latest_response |
||||||
|
|
||||||
|
- name: Extract the Besu version |
||||||
|
ansible.builtin.set_fact: |
||||||
|
_besu_version: "{{ _besu_latest_response.json.tag_name }}" |
||||||
|
|
||||||
|
- name: Validate the Besu version |
||||||
|
ansible.builtin.assert: |
||||||
|
that: _besu_version is search("^[0-9]+\.[0-9]+\.[0-9]+(-RC[0-9])?$") |
||||||
|
fail_msg: "Retrieved version [{{ _besu_version }}] is not a valid" |
||||||
|
|
||||||
|
- name: Information |
||||||
|
debug: |
||||||
|
msg: "Latest Besu version is {{ _besu_version }}" |
Loading…
Reference in new issue