1
1
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_gitea.git synced 2024-08-16 11:39:50 +02:00

Add check to run task in check mod & a error message.

This commit is contained in:
N07070 2022-06-21 12:11:12 +02:00
parent 586d277985
commit 520dbaa3c2

View file

@ -14,15 +14,23 @@
url: https://api.github.com/repos/go-gitea/gitea/releases/latest url: https://api.github.com/repos/go-gitea/gitea/releases/latest
return_content: true return_content: true
register: gitea_remote_metadata register: gitea_remote_metadata
when: not ansible_check_mode
- name: "Fail if running in check mode without versions set."
fail:
msg: "You are running this playbook in check mode : please set the gitea version with gitea_version, the URI module cannot load the latest version while in this mode."
when: ansible_check_mode and ( gitea_version not defined )
- name: "Set fact latest gitea release" - name: "Set fact latest gitea release"
ansible.builtin.set_fact: ansible.builtin.set_fact:
gitea_remote_version: "{{ gitea_remote_metadata.json.tag_name[1:] }}" gitea_remote_version: "{{ gitea_remote_metadata.json.tag_name[1:] }}"
when: not ansible_check_mode
- name: "Set gitea version target (latest)" - name: "Set gitea version target (latest)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
gitea_version_target: "{{ gitea_remote_version }}" gitea_version_target: "{{ gitea_remote_version }}"
when: gitea_version == "latest" when: not ansible_check_mode
when: gitea_version == "latest"
- name: "Set gitea version target ({{ gitea_version }})" - name: "Set gitea version target ({{ gitea_version }})"
ansible.builtin.set_fact: ansible.builtin.set_fact: