Files
ansible/roles/gitea/tasks/main.yml
2025-02-28 15:39:53 +01:00

87 lines
1.7 KiB
YAML

---
- name: Init db
ansible.builtin.include_tasks: db.yml
- name: Install prerequisites
ansible.builtin.package:
name: git
state: present
update_cache: true
- name: Download Gitea executable
ansible.builtin.get_url:
url: "{{ gitea_url }}"
dest: "{{ gitea_bin }}"
owner: root
group: root
mode: "0o755"
force: true
notify:
- Restart Gitea
- name: Create git user
ansible.builtin.user:
name: git
password: '*'
comment: "Git Version Control"
home: /home/git
shell: /bin/bash
state: present
- name: Create Gitea base dir
ansible.builtin.file:
state: directory
path: "{{ gitea_path }}"
owner: git
group: git
mode: "0o755"
- name: Create Gitea sub dirs
ansible.builtin.file:
state: directory
path: "{{ gitea_path }}/{{ item }}"
owner: git
group: git
mode: "0o755"
loop:
- custom
- data
- log
- name: Create Gitea config dir
ansible.builtin.file:
state: directory
path: "{{ gitea_etc_path }}"
owner: root
group: git
mode: "0o750"
- name: Create Gitea config file
ansible.builtin.template:
src: app.ini.j2
dest: "{{ gitea_etc_path }}/app.ini"
owner: root
group: git
mode: "0o640"
notify:
- Restart Gitea
- name: Create systemd Gitea file
ansible.builtin.template:
src: gitea.service.j2
dest: /etc/systemd/system/gitea.service
owner: root
group: root
mode: "0o640"
notify:
- Restart Gitea
- name: Retrieve Gitea Act Runner Token
become: true
become_user: git
ansible.builtin.command:
cmd: "gitea --config {{ gitea_etc_path }}/app.ini actions generate-runner-token"
register: _gitea_runner_token
changed_when: false