Compare commits

..

No commits in common. "5ee4391bc3b686c5963cde7da069b653c4ed035b" and "294c1263f6a84d8144703dcdc204873e56fa02b8" have entirely different histories.

2 changed files with 23 additions and 28 deletions

View File

@ -14,7 +14,7 @@ gitea_service_state: started
gitea_service_enabled: yes gitea_service_enabled: yes
gitea_version: 1.12.2 gitea_version: 1.12.2
gitea_url: "https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-{{ ansible_system | lower }}-{{ gitea_go_arch }}" gitea_url: "https://dl.gitea.io/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_go_arch }}"
gitea_bin_path: /usr/local/bin gitea_bin_path: /usr/local/bin
gitea_var_path: /var/lib/gitea gitea_var_path: /var/lib/gitea
gitea_log_path: /var/log/gitea gitea_log_path: /var/log/gitea

View File

@ -1,14 +1,10 @@
--- ---
- name: determine if installed - block:
- name: determine if installed
stat: stat:
path: "{{ gitea_bin_path }}/gitea" path: "{{ gitea_bin_path }}/gitea"
register: st register: st
- name: set gitea_installed
set_fact:
gitea_installed: st.stat.exists
- block:
- name: determine latest version - name: determine latest version
uri: uri:
url: https://api.github.com/repos/go-gitea/gitea/releases/latest url: https://api.github.com/repos/go-gitea/gitea/releases/latest
@ -18,31 +14,30 @@
until: _latest_version.status == 200 until: _latest_version.status == 200
retries: 3 retries: 3
- name: get checksums
set_fact:
checksum_string: "{{ lookup('url', gitea_url + '.sha256') }}"
- name: set gitea_checksum
set_fact:
gitea_checksum: "sha256:{{ checksum_string.split(' ') | first }}"
- block:
- name: determine installed version - name: determine installed version
command: "{{ gitea_bin_path }}/gitea --version" command: "{{ gitea_bin_path }}/gitea --version"
register: _installed_version_string register: _installed_version_string
changed_when: false changed_when: false
when: st.stat.exists
- name: set gitea_local_version - name: set gitea facts
set_fact: set_fact:
gitea_local_version: "{{ _installed_version_string.stdout | regex_search('^Gitea version ([\\d.]+)', '\\1') | first }}" gitea_local_version: "{{ _installed_version_string.stdout | regex_search('^Gitea version ([\\d.]+)', '\\1') | first }}"
when: st.stat.exists
- name: set gitea_local_version - name: set gitea facts
set_fact:
gitea_version: "{{ _latest_version.json['tag_name'] | regex_replace('^v', '') }}"
when: gitea_installed | bool
- block:
- name: set gitea_local_version to 0
set_fact: set_fact:
gitea_local_version: "0" gitea_local_version: "0"
when: not gitea_installed | bool when: not st.stat.exists
- name: set gitea facts
set_fact:
gitea_version: "{{ _latest_version.json['tag_name'] | regex_replace('^v', '') }}"
- name: download checksums
set_fact:
checksum_string: "{{ lookup('url', gitea_url + '.sha256') }}"
- name: set gitea checksum
set_fact:
gitea_checksum: "sha256:{{ checksum_string.split(' ') | first }}"