1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_etesync_dav.git synced 2024-08-16 10:09:54 +02:00
ansible_role_etesync_dav/tasks/get_version_of_etesync_dav.yml

39 lines
1.5 KiB
YAML
Raw Normal View History

2023-10-24 02:11:32 +02:00
---
- name: "Determine 'latest' version release"
when: etesync_dav__version == "latest"
block:
- name: "Get latest etesync-dav release metadata"
ansible.builtin.uri:
url: "{{ etesync_dav__repo_api }}"
return_content: true
register: etesync_dav__remote_metadata
become: false
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 desired version with the variable
'etesync_dav__version', because the URI module cannot detect the latest version in this mode."
when: ansible_check_mode and (etesync_dav__version == 'latest')
- name: "Set fact latest etesync-dav release"
ansible.builtin.set_fact:
etesync_dav__remote_version: "{{ etesync_dav__remote_metadata.json.tag_name[1:] }}"
when: not ansible_check_mode
- name: "Set etesync-dav version target (latest)"
ansible.builtin.set_fact:
etesync_dav__version_target: "{{ etesync_dav__remote_version }}"
when: not ansible_check_mode
- name: "Set etesync-dav version target {{ etesync_dav__version }}"
ansible.builtin.set_fact:
etesync_dav__version_target: "{{ etesync_dav__version }}"
when: etesync_dav__version != "latest"
- name: "Generate etesync-dav download URL"
ansible.builtin.set_fact:
etesync_dav__dl_url: "https://github.com/etesync/etesync-dav/releases/download/v{{ etesync_dav__version_target }}/linux-amd64-etesync-dav"