diff --git a/tasks/set_version.yml b/tasks/set_version.yml index 469b344..20810cb 100644 --- a/tasks/set_version.yml +++ b/tasks/set_version.yml @@ -14,14 +14,24 @@ url: https://api.github.com/repos/go-gitea/gitea/releases/latest return_content: true register: gitea_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 Gitea version with the variable 'gitea_version', because the URI module cannot detect the latest version in this mode." + when: ansible_check_mode and ( gitea_version == 'latest' or gitea_version == 'present' ) - name: "Set fact latest gitea release" ansible.builtin.set_fact: gitea_remote_version: "{{ gitea_remote_metadata.json.tag_name[1:] }}" + when: not ansible_check_mode - name: "Set gitea version target (latest)" ansible.builtin.set_fact: gitea_version_target: "{{ gitea_remote_version }}" + when: not ansible_check_mode when: gitea_version == "latest" - name: "Set gitea version target ({{ gitea_version }})" diff --git a/vars/main.yml b/vars/main.yml index 33efc57..eb96c97 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -56,5 +56,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 37 # should be int +playbook_version_number: 38 # should be int playbook_version_path: 'do1jlr.gitea.version'