2022-11-10 22:47:17 +01:00
|
|
|
---
|
|
|
|
- name: "Determine 'latest' version release"
|
|
|
|
when: etebase__version == "latest"
|
|
|
|
block:
|
|
|
|
- name: "Get latest etebase release metadata"
|
|
|
|
ansible.builtin.uri:
|
|
|
|
url: "{{ etebase__repo_api }}"
|
|
|
|
return_content: true
|
|
|
|
register: etebase_remote_metadata
|
|
|
|
when: not ansible_check_mode
|
|
|
|
|
|
|
|
- name: "Fail if running in check mode without versions set."
|
|
|
|
ansible.builtin.fail:
|
|
|
|
msg: |
|
|
|
|
"You are running this playbook in check mode:
|
|
|
|
Please set the Etebase version with the variable 'etebase__version', because the
|
|
|
|
URI module cannot detect the latest version in this mode."
|
|
|
|
when: ansible_check_mode and (etebase__version == 'latest' or etebase__version == 'present')
|
|
|
|
|
2023-10-23 22:23:49 +02:00
|
|
|
- name: Extract semantic version tags
|
2022-11-10 22:47:17 +01:00
|
|
|
ansible.builtin.set_fact:
|
2023-10-23 22:23:49 +02:00
|
|
|
semantic_version_tags: "{{ etebase_remote_metadata.json | selectattr('name', 'match', '^[0-9]+\\.[0-9]+\\.[0-9]+$') | list }}"
|
|
|
|
|
|
|
|
- name: Sort semantic version tags
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
sorted_semantic_version_tags: "{{ semantic_version_tags | sort(attribute='name') }}"
|
|
|
|
|
|
|
|
- name: Get the latest tag
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
etebase__latest_tag: "{{ sorted_semantic_version_tags | last }}"
|
2022-11-10 22:47:17 +01:00
|
|
|
|
2023-10-23 22:23:49 +02:00
|
|
|
- name: "Set etebase version target (latest tag)"
|
2022-11-10 22:47:17 +01:00
|
|
|
ansible.builtin.set_fact:
|
2023-10-23 22:23:49 +02:00
|
|
|
etebase_version_target: "{{ etebase__latest_tag.name }}"
|
2022-11-10 22:47:17 +01:00
|
|
|
when: not ansible_check_mode
|
|
|
|
|
|
|
|
- name: "Set etebase version target {{ etebase__version }}"
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
etebase_version_target: "{{ etebase__version }}"
|
|
|
|
when: etebase__version != "latest"
|
|
|
|
|
2023-10-29 14:43:07 +01:00
|
|
|
- name: Print Etebase Version # noqa: H500
|
2022-11-10 22:47:17 +01:00
|
|
|
ansible.builtin.debug:
|
|
|
|
verbosity: 1
|
2023-10-23 22:23:49 +02:00
|
|
|
msg: "etebase version is set to {{ etebase_version_target }}"
|