role_gitea/tasks/main.yml

77 lines
2.0 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: 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=
become: true
notify: Redémarrer gitea.service
- name: Déployer le service
ansible.builtin.template:
owner: root
group: root
mode: u=rw,g=r,o=r
src: gitea.service.j2
dest: /etc/systemd/system/gitea.service
become: true
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
become: true