63 lines
1.4 KiB
YAML
63 lines
1.4 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 Data Directory
|
|
file:
|
|
path: "{{ git_user.home }}/gitea/data"
|
|
state: directory
|
|
owner: "{{ git_user.uid }}"
|
|
group: "{{ git_user.group }}"
|
|
mode: '0755'
|
|
|
|
- name: Create Config Directory
|
|
file:
|
|
path: "{{ git_user.home }}/gitea/config"
|
|
state: directory
|
|
owner: "{{ git_user.uid }}"
|
|
group: "{{ git_user.group }}"
|
|
mode: '0755'
|
|
|
|
- name: Start Docker Daemon
|
|
systemd:
|
|
name: docker
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: Upload Environment File
|
|
ansible.builtin.template:
|
|
src: environment.env.j2
|
|
dest: "{{ git_user.home }}/gitea/environment.env"
|
|
owner: "{{ git_user.name }}"
|
|
mode: '600'
|
|
|
|
- name: Create Gitea container
|
|
community.docker.docker_container:
|
|
name: gitea
|
|
image: "gitea/gitea:{{ gitea_vars['version'] }}-rootless"
|
|
comparisons:
|
|
image: strict
|
|
volumes: strict
|
|
env: strict
|
|
restart_policy: unless-stopped
|
|
volumes:
|
|
- "{{ git_user.home }}/gitea/data:/var/lib/gitea"
|
|
- "{{ git_user.home }}/gitea/config:/etc/gitea"
|
|
- /etc/timezone:/etc/timezone:ro
|
|
- /etc/localtime:/etc/localtime:ro
|
|
ports:
|
|
- "3000:3000"
|
|
- "22:2222"
|
|
user: "{{ git_user.uid }}:{{ git_user.group }}"
|
|
env_file: "{{ git_user.home }}/gitea/environment.env"
|