2023-07-06 15:56:19 +00:00
|
|
|
---
|
|
|
|
# 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
|
2024-01-19 09:35:17 +00:00
|
|
|
when: gitea_version == "latest"
|
2023-07-06 15:56:19 +00:00
|
|
|
register: version_file
|
|
|
|
|
|
|
|
- name: Extraire la dernière version
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
gitea_version: "{{ (version_file.content | from_json).latest.version }}"
|
2024-01-19 09:35:17 +00:00
|
|
|
when: gitea_version == "latest"
|
2023-07-06 15:56:19 +00:00
|
|
|
|
|
|
|
- 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
|
|
|
|
|
2024-01-16 13:26:36 +00:00
|
|
|
- name: Créer le dossier de configuration
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ gitea_install_path }}/custom/conf/"
|
|
|
|
state: directory
|
|
|
|
owner: gitea
|
|
|
|
group: gitea
|
|
|
|
mode: u=rwX,g=rX,o=
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Déployer le fichier de configuration
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ inventory_hostname }}.ini.j2"
|
|
|
|
dest: "{{ gitea_install_path }}/custom/conf/app.ini"
|
|
|
|
owner: gitea
|
|
|
|
group: gitea
|
|
|
|
mode: u=rw,g=r,o=
|
2023-07-06 15:56:19 +00:00
|
|
|
become: true
|
2024-01-16 13:26:36 +00:00
|
|
|
notify: Redémarrer gitea.service
|
|
|
|
|
|
|
|
- name: Déployer le service
|
2023-07-06 15:56:19 +00:00
|
|
|
ansible.builtin.template:
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
src: gitea.service.j2
|
|
|
|
dest: /etc/systemd/system/gitea.service
|
2024-01-16 13:26:36 +00:00
|
|
|
become: true
|
2023-07-06 15:56:19 +00:00
|
|
|
notify: Redémarrer gitea.service
|
|
|
|
|
|
|
|
- name: Déployer la configuration logrotate
|
|
|
|
ansible.builtin.template:
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
src: logrotate.conf.j2
|
|
|
|
dest: /etc/logrotate.d/gitea
|
2024-01-16 13:26:36 +00:00
|
|
|
become: true
|