first commit

This commit is contained in:
Christoph Haug 2022-12-10 13:34:49 +01:00
parent f9cf782f73
commit 67cea2f5f4
3 changed files with 41 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.venv

10
tasks/upgrade.yaml Normal file
View 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
View 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