74 lines
1.5 KiB
YAML
74 lines
1.5 KiB
YAML
|
|
---
|
|
#- name: Install Dependencies
|
|
# apt:
|
|
# pkg:
|
|
# - apparmor
|
|
# - docker.io
|
|
# - python3-docker
|
|
|
|
- name: Create git USER
|
|
ansible.builtin.user:
|
|
name: git
|
|
register: git_user
|
|
|
|
- name: Create Gitea
|
|
file:
|
|
path: "/opt/gitea"
|
|
state: directory
|
|
owner: root
|
|
mode: 0755
|
|
|
|
- name: Create Data Directory
|
|
file:
|
|
path: "/opt/gitea/data"
|
|
state: directory
|
|
owner: "{{ git_user.uid }}"
|
|
group: "{{ git_user.group }}"
|
|
mode: 0700
|
|
|
|
- name: Create Config Directory
|
|
file:
|
|
path: "/opt/gitea/config"
|
|
state: directory
|
|
owner: "{{ git_user.uid }}"
|
|
group: "{{ git_user.group }}"
|
|
mode: 0700
|
|
|
|
- name: Start Docker Daemon
|
|
systemd:
|
|
name: docker
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: Upload Environment File
|
|
ansible.builtin.template:
|
|
src: environment.env.j2
|
|
dest: "/opt/gitea/environment.env"
|
|
owner: root
|
|
mode: 0600
|
|
register: gitea_env
|
|
|
|
- name: Upload docker-compose.yaml
|
|
ansible.builtin.template:
|
|
src: docker-compose.yaml.j2
|
|
dest: /opt/gitea/docker-compose.yaml
|
|
owner: root
|
|
mode: 0600
|
|
register: gitea_container
|
|
|
|
- name: Create / Recreate Gitea container
|
|
community.docker.docker_compose:
|
|
project_src: /opt/gitea
|
|
state: present
|
|
restarted: true
|
|
when: gitea_env.changed or gitea_container.changed
|
|
|
|
- name: Check if {{ gitea.hostname }}.{{ gitea.domain }} is available and returning status 200
|
|
ansible.builtin.uri:
|
|
url: "https://{{ gitea.hostname }}.{{ gitea.domain }}"
|
|
register: _result
|
|
until: _result.status == 200
|
|
retries: 60
|
|
delay: 10
|