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.
91 lines
2.0 KiB
YAML
91 lines
2.0 KiB
YAML
6 years ago
|
---
|
||
|
|
||
|
- 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/false
|
||
|
home: "{{ gitea_user_directory }}"
|
||
|
|
||
|
- name: Configure user directory
|
||
|
file:
|
||
|
path: "{{ gitea_user_directory }}"
|
||
|
state: directory
|
||
|
mode: 0750
|
||
|
|
||
|
- name: Configure installation directory
|
||
|
file:
|
||
|
path: "{{ gitea_installation_directory }}"
|
||
|
state: directory
|
||
|
owner: "root"
|
||
|
group: "root"
|
||
|
mode: 0755
|
||
|
|
||
|
- name: Configure custom directory
|
||
|
file:
|
||
|
path: "{{ gitea_custom_directory }}"
|
||
|
state: directory
|
||
|
mode: 0750
|
||
|
|
||
|
- name: Configure repositories directory
|
||
|
file:
|
||
|
path: "{{ gitea_repositories_directory }}"
|
||
|
state: directory
|
||
|
mode: 0750
|
||
|
|
||
|
- name: Configure gitea
|
||
|
template:
|
||
|
dest: "{{ gitea_configuration_path }}"
|
||
|
group: "{{ gitea_system_user }}"
|
||
|
mode: 0640
|
||
|
owner: root
|
||
|
src: "app.ini"
|
||
|
register: gitea_configure
|
||
|
|
||
|
- name: Install auto update script for gitea
|
||
|
template:
|
||
|
src: "{{ gitea_update_script }}"
|
||
|
group: root
|
||
|
mode: 0744
|
||
|
owner: root
|
||
|
dest: "{{ gitea_update_script_path }}"
|
||
|
|
||
|
- name: Download gitea
|
||
|
become_user: "{{ gitea_system_user }}"
|
||
|
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
|