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 toggle to do a version check before download

Old behavior is to download the binary of `gitea_version` every run,
then checksum it against the currently installed version to see if it needs
to be copied over.

New behavior is to attempt to extract the current running version of gitea
and only initiate the old behavior if the running version != `gitea_version`.

Default is old behavior due to the major logic change involved.
This commit is contained in:
Trysdyn Black 2019-04-27 17:00:35 -07:00 committed by Thomas Maurice
parent 609a47de72
commit 3226a76d94
3 changed files with 12 additions and 2 deletions

View file

@ -8,7 +8,7 @@ Gitea is a Golang Git repository webapp, having the same look and feel as GitHub
It is still under developpement, see "Disclaimer" if you can't make it work. It is still under developpement, see "Disclaimer" if you can't make it work.
## Sample exemple of use in a playbook ## Sample example of use in a playbook
The following have been tested with Debian 8, it should work on Ubuntu as well. The following have been tested with Debian 8, it should work on Ubuntu as well.
@ -55,6 +55,7 @@ The following have been tested with Debian 8, it should work on Ubuntu as well.
## More detailed options ## More detailed options
### General ### General
* `gitea_version_check`: Check if installed version != `gitea_version` before initiating binary download
* `gitea_user`: UNIX user used by Gitea * `gitea_user`: UNIX user used by Gitea
* `gitea_home`: Base directory to work * `gitea_home`: Base directory to work

View file

@ -1,5 +1,6 @@
--- ---
gitea_version: "1.7.5" gitea_version: "1.7.5"
gitea_version_check: false
gitea_app_name: "Gitea" gitea_app_name: "Gitea"
gitea_user: "gitea" gitea_user: "gitea"

View file

@ -1,4 +1,11 @@
--- ---
- name: "Check gitea version"
shell: "/usr/local/bin/gitea -v | cut -d' ' -f 3"
register: gitea_active_version
changed_when: false
failed_when: false
when: gitea_version_check
- name: "Download the binary" - name: "Download the binary"
get_url: get_url:
url: "{{ gitea_dl_url }}/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_arch }}" url: "{{ gitea_dl_url }}/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_arch }}"
@ -8,6 +15,7 @@
mode: 0755 mode: 0755
force: true force: true
notify: "Restart gitea" notify: "Restart gitea"
when: (gitea_version_check == false) or (gitea_active_version.stdout != gitea_version)
- include: create_user.yml - include: create_user.yml