This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
homeserver-ansible/roles/services/gitea/tasks/main.yml

73 lines
1.4 KiB
YAML
Raw Normal View History

2022-02-27 16:05:34 -05:00
- name: Install gitea packages
community.general.pacman:
name: gitea
state: present
- name: Configure gitea
template:
src: templates/gitea_app.ini.j2
dest: /etc/gitea/app.ini
2022-03-01 17:43:44 -05:00
notify: Restart gitea
2022-02-27 16:05:34 -05:00
- name: Set data path
set_fact:
data_path: "{{ dataroot }}/gitea/"
- name: Create systemd override dir
file:
path: /etc/systemd/system/gitea.service.d/
state: directory
owner: root
group: root
mode: 0755
- name: Deploy systemd override conf
template:
src: gitea.service.j2
dest: /etc/systemd/system/gitea.service.d/override.conf
owner: root
group: root
mode: 0644
2022-04-05 20:42:12 -04:00
notify:
- Run daemon-reload for gitea
- Restart gitea
2022-03-01 17:43:44 -05:00
2022-03-02 19:58:31 -05:00
- name: Find owner of data folder
stat:
path: "{{ data_path }}"
2022-03-02 19:58:31 -05:00
register: data_folder
- name: Ensure data folder is under correct owner
file:
path: "{{ data_path }}"
2022-03-02 19:58:31 -05:00
state: directory
recurse: yes
owner: gitea
group: gitea
when: data_folder.stat.pw_name != "gitea"
- name: Get gitea user information
user:
name: gitea
state: present
register: gitea_user
2022-03-01 17:43:44 -05:00
- name: Ensure gitea is stopped
service:
name: gitea
state: stopped
when: gitea_user.home != data_path[:-1]
2022-02-27 16:05:34 -05:00
- name: Change homedir of gitea
user:
name: gitea
home: "{{ data_path }}"
2022-03-01 17:43:44 -05:00
notify: Restart gitea
when: gitea_user.home != data_path[:-1]
2022-02-27 16:05:34 -05:00
- name: Enable gitea
service:
name: gitea
2022-03-01 17:43:44 -05:00
state: started
2022-02-27 16:05:34 -05:00
enabled: yes