role_gitea/tasks/main.yml

58 lines
1.5 KiB
YAML
Executable File

---
# tasks file for gitea
- name: Créer les dossiers
ansible.builtin.file:
owner: gitea
group: gitea
mode: u=rwx,g=rx,o=rx
state: directory
path: "{{ item }}"
become: true
loop:
- "{{ gitea_install_path }}"
- "{{ gitea_logs_path }}"
- name: Récupérer le contenu du fichier de version
ansible.builtin.uri:
url: "{{ gitea_version_file }}"
return_content: true
follow_redirects: all
when: not gitea_version | length > 0
register: version_file
- name: Extraire la dernière version
ansible.builtin.set_fact:
gitea_version: "{{ (version_file.content | from_json).latest.version }}"
when: not gitea_version | length > 0
- name: Télécharger le binaire
ansible.builtin.get_url:
owner: gitea
group: gitea
mode: u=rwx,g=,o=
checksum: "sha256:https://dl.gitea.io/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_architecture }}.sha256"
url: https://dl.gitea.io/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_architecture }}
dest: "{{ gitea_install_path }}/gitea.bin"
become: true
notify: Redémarrer gitea.service
- name: Déployer le service
become: true
ansible.builtin.template:
owner: root
group: root
mode: u=rw,g=r,o=r
src: gitea.service.j2
dest: /etc/systemd/system/gitea.service
notify: Redémarrer gitea.service
- name: Déployer la configuration logrotate
become: true
ansible.builtin.template:
owner: root
group: root
mode: u=rw,g=r,o=r
src: logrotate.conf.j2
dest: /etc/logrotate.d/gitea