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

Merge pull request #84 from N07070/82-better-errors-on-check-mode

Add check to run task in check mod & a error message.
This commit is contained in:
L3D 2022-06-21 17:40:46 +02:00 committed by GitHub
commit 3625ace9e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -14,14 +14,24 @@
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."
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" - 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: not ansible_check_mode
when: gitea_version == "latest" when: gitea_version == "latest"
- name: "Set gitea version target ({{ gitea_version }})" - name: "Set gitea version target ({{ gitea_version }})"

View file

@ -56,5 +56,5 @@ transfer_custom_footer:
- 'files/gitea_footer/extra_links_footer.tmpl' - 'files/gitea_footer/extra_links_footer.tmpl'
- 'files/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' playbook_version_path: 'do1jlr.gitea.version'