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.

96 lines
2.3 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"
- name: Configure installation directory
file:
path: "{{ gitea_installation_directory }}"
state: directory
owner: "{{ gitea_system_user }}"
group: "{{ gitea_system_user }}"
mode: "u=rwx,g=rx"
- name: Configure custom directory
file:
path: "{{ gitea_custom_directory }}"
state: directory
owner: "{{ gitea_system_user }}"
group: "{{ gitea_system_user }}"
mode: "u=rwx,g=rx"
- name: Configure repositories directory
file:
path: "{{ gitea_repositories_directory }}"
state: directory
owner: "{{ gitea_system_user }}"
group: "{{ gitea_system_user }}"
mode: "u=rwx,g=rx"
- name: Configure gitea
template:
src: "app.ini"
dest: "{{ gitea_configuration_path }}"
mode: 0640
owner: root
group: "{{ gitea_system_user }}"
register: gitea_configure
- 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 }}"
register: gitea_binary_download
- name: Register service for gitea
template:
src: "gitea.service"
dest: "/etc/systemd/system/{{ gitea_service_name }}"
register: gitea_register_service
# TODO Change to handler
- name: Enable service for gitea
systemd:
daemon_reload: yes
enabled: yes
name: "{{ gitea_service_name }}"
state: restarted
when: gitea_configure.changed or gitea_binary_download.changed or gitea_register_service.changed
- name: Enable auto update of gitea
cron:
hour: "2"
job: "{{ gitea_update_script_path }}"
name: "update gitea for {{ domain }}"
state: present