You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.5 KiB
YAML

---
- name: Install required dependencies
apt:
state: present
name:
- git
- gnupg2
- openssh-server
- name: Configure system user
user:
state: present
name: "{{ gitea_system_user }}"
system: yes
shell: /bin/bash # Required for ssh access
home: "{{ gitea_user_directory }}"
- name: Configure user directory
file:
path: "{{ gitea_user_directory }}"
state: directory
owner: "{{ gitea_system_user }}"
group: "{{ nginx_system_user }}"
mode: "u=rwx,g=rx,o="
- name: Configure installation directory
file:
path: "{{ gitea_installation_directory }}"
state: directory
owner: "{{ gitea_system_user }}"
group: "{{ gitea_system_user }}"
mode: "u=rwx,g=rx,o="
- name: Configure custom directory
file:
path: "{{ gitea_custom_directory }}"
state: directory
owner: "{{ gitea_system_user }}"
group: "{{ gitea_system_user }}"
mode: "u=rwx,g=rx,o="
- name: Configure repositories directory
file:
path: "{{ gitea_repositories_directory }}"
state: directory
owner: "{{ gitea_system_user }}"
group: "{{ gitea_system_user }}"
mode: "u=rwx,g=rx,o="
- name: Configure gitea
template:
src: "app.ini"
dest: "{{ gitea_configuration_path }}"
mode: "u=rw,g=r,o="
owner: root
group: "{{ gitea_system_user }}"
notify: restart gitea
- name: Install auto update script for gitea
template:
src: "{{ gitea_update_script }}"
dest: "{{ gitea_update_script_path }}"
owner: root
group: root
mode: "u=rwx,g=rx,o=r"
- name: Download gitea
command: "{{ gitea_update_script_path }}"
args:
chdir: "{{ gitea_installation_directory }}"
creates: "{{ gitea_binary_path }}"
notify: restart gitea
- name: Register service for gitea
template:
src: "gitea.service"
dest: "{{ global_systemd_configuration_directory }}/{{ gitea_service_name }}"
owner: root
group: root
mode: "u=rw,g=r,o="
notify:
- reload systemd
- restart gitea
- name: Configure auto backup of gitea repositories directory
cron:
hour: 1
minute: 0
job: "{{ global_helper_directory }}/backup_files.sh {{ gitea_repositories_directory | quote }} {{ domain | quote }}"
name: "backup gitea repositories of {{ domain }}"
state: present
# TODO Disable backup in update process
- name: Enable auto update of gitea
cron:
hour: 2
minute: 0
job: "{{ gitea_update_script_path }}"
name: "update gitea for {{ domain }}"
state: present