- name: Download gitea get_url: url: https://dl.gitea.com/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-amd64 dest: /usr/local/bin/gitea mode: 0755 - name: Create a git group group: name: git state: present gid: 1050 - name: Create a git user user: name: git uid: 1050 group: 1050 comment: "git user" shell: /bin/bash state: present create_home: yes - name: Create gitea data and logging directories file: path: "{{ item }}" state: directory mode: 0750 owner: git group: git loop: - /var/lib/gitea - /var/lib/gitea/custom - /var/lib/gitea/log - /var/lib/gitea/data - name: Create gitea config directory file: path: "/etc/gitea" state: directory mode: 0770 owner: root group: git - name: Install gitea service template: src: templates/gitea.service.j2 dest: /etc/systemd/system/gitea.service owner: root group: root mode: 0640 register: gitea_service notify: Restart gitea - name: systemctl daemon-reload to pickup gitea service changes systemd_service: daemon_reload: true when: gitea_service.changed notify: Restart gitea - name: Check if gitea web installer wrote its config stat: path: /etc/gitea/app.ini" register: gitea_config_check - name: Start and enable gitea service: name: gitea state: started enabled: true - name: Update gitea config directory permissions post install file: path: "/etc/gitea" state: directory mode: 0750 owner: root group: git when: gitea_config_check.stat.exists - name: Update gitea config file permissions post install file: path: "/etc/gitea/app.ini" mode: 0640 owner: root group: git when: gitea_config_check.stat.exists