docker compose und nach /opt/gitea verschoben

This commit is contained in:
Marius Alwan Meyer 2023-02-06 12:50:22 +01:00
parent ddf9fa27f1
commit 3f400ba979
2 changed files with 37 additions and 22 deletions

View File

@ -12,13 +12,20 @@
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: '0755'
mode: 0755
- name: Create Config Directory
file:
@ -26,7 +33,7 @@
state: directory
owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}"
mode: '0755'
mode: 0755
- name: Start Docker Daemon
systemd:
@ -38,25 +45,17 @@
ansible.builtin.template:
src: environment.env.j2
dest: "/opt/gitea/environment.env"
owner: "{{ git_user.name }}"
mode: '600'
owner: root
mode: 0644
- name: Upload docker-compose.yaml
ansible.builtin.template:
src: docker-compose.yaml.j2
dest: /opt/gitea/docker-compose.yaml
owner: root
mode: 0644
- name: Create Gitea container
community.docker.docker_container:
name: gitea
image: "gitea:{{ gitea_vars['version'] }}-rootless"
comparisons:
image: strict
volumes: strict
env: strict
restart_policy: unless-stopped
volumes:
- /opt/gitea/data:/var/lib/gitea"
- /opt/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: "/opt/gitea/environment.env"
community.docker.docker_compose:
project_src: /opt/gitea
state: present

View File

@ -0,0 +1,16 @@
version: "3.8"
services:
server:
image: gitea/gitea:{{ gitea_vars['version'] }}-rootless
restart: always
volumes:
- ./data:/var/lib/gitea
- ./config:/etc/gitea
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "22:2222"
env_file: ./environment.env
user: "{{ git_user.uid }}:{{ git_user.group }}"