70 lines
1.7 KiB
YAML
70 lines
1.7 KiB
YAML
- name: Include gitea variables
|
|
include_vars: gitea.yml
|
|
|
|
- name: Create gitea directory
|
|
file:
|
|
path: '/opt/gitea'
|
|
state: directory
|
|
owner: "{{ docker_user.name }}"
|
|
mode: "{{ docker_compose_directory_mask }}"
|
|
become: true
|
|
|
|
- name: Create gitea config directory
|
|
file:
|
|
path: '/opt/gitea/gitea/gitea/conf'
|
|
state: directory
|
|
mode: "{{ docker_compose_directory_mask }}"
|
|
become: true
|
|
|
|
- name: Create cgit config directory
|
|
file:
|
|
path: '/opt/gitea/cgit'
|
|
state: directory
|
|
mode: "{{ docker_compose_directory_mask }}"
|
|
become: true
|
|
|
|
- name: Install gitea compose file
|
|
template:
|
|
src: files/gitea/docker-compose.yml
|
|
dest: "/opt/gitea/docker-compose.yml"
|
|
mode: "{{ docker_compose_file_mask }}"
|
|
owner: "{{ docker_user.name }}"
|
|
validate: /usr/bin/docker-compose -f %s config
|
|
register: compose_file
|
|
become: true
|
|
|
|
- name: Install gitea config file
|
|
template:
|
|
src: files/gitea/app.ini
|
|
dest: "/opt/gitea/gitea/gitea/conf/app.ini"
|
|
mode: "{{ docker_compose_file_mask }}"
|
|
owner: "{{ docker_user.name }}"
|
|
register: gitea_config_file
|
|
become: true
|
|
|
|
- name: Install cgit config file
|
|
template:
|
|
src: files/gitea/cgitrc
|
|
dest: "/opt/gitea/cgit/cgitrc"
|
|
mode: "{{ docker_compose_file_mask }}"
|
|
owner: "{{ docker_user.name }}"
|
|
register: cgit_config_file
|
|
become: true
|
|
|
|
- name: Touch public repos file
|
|
file:
|
|
path: /opt/gitea/cgit/repos.txt
|
|
state: file
|
|
become: true
|
|
|
|
- name: Cycle gitea container
|
|
docker_compose:
|
|
project_src: /opt/gitea
|
|
pull: true
|
|
remove_orphans: true
|
|
remove_volumes: true
|
|
state: "{{ item }}"
|
|
when: compose_file.changed or gitea_config_file.changed or cgit_config_file.changed
|
|
loop:
|
|
- absent
|
|
- present
|