first commit
This commit is contained in:
parent
f9cf782f73
commit
67cea2f5f4
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.venv
|
10
tasks/upgrade.yaml
Normal file
10
tasks/upgrade.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
- debug:
|
||||
msg: "upgrade gitea {{ available_version }}"
|
||||
- name: Download new Gitea
|
||||
ansible.builtin.get_url:
|
||||
url: "https://dl.gitea.io/gitea/{{ available_version}}/gitea-{{ available_version}}-linux-amd64"
|
||||
dest: /usr/local/bin/gitea
|
||||
group: root
|
||||
owner: root
|
||||
mode: '0755'
|
30
upgrade.yaml
Normal file
30
upgrade.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: Update Gitea
|
||||
hosts: localhost
|
||||
become: yes
|
||||
tasks:
|
||||
- name: Read Git version
|
||||
uri:
|
||||
method: GET
|
||||
url: https://dl.gitea.io/gitea/version.json
|
||||
return_content: yes
|
||||
headers:
|
||||
Accept: application/json
|
||||
register: response_gitea_version
|
||||
- name: Read installed gitea version
|
||||
command: gitea --version
|
||||
register: gitea_version
|
||||
- name: Set available gitea version
|
||||
set_fact:
|
||||
available_version: "{{ response_gitea_version.content | from_json | json_query('latest.version') }}"
|
||||
installed_version: "{{ gitea_version.stdout.split(' ')[2] }}"
|
||||
- debug:
|
||||
msg: "{{ available_version }}"
|
||||
- debug:
|
||||
msg: "{{ installed_version }}"
|
||||
- include: tasks/upgrade.yaml
|
||||
when: available_version is version(installed_version,'>')
|
||||
- name: restart gitea
|
||||
ansible.builtin.service:
|
||||
name: gitea
|
||||
state: restarted
|
Loading…
Reference in New Issue
Block a user