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 name: git
register: git_user register: git_user
- name: Create Gitea
file:
path: "/opt/gitea"
state: directory
owner: root
mode: 0755
- name: Create Data Directory - name: Create Data Directory
file: file:
path: "/opt/gitea/data" path: "/opt/gitea/data"
state: directory state: directory
owner: "{{ git_user.uid }}" owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}" group: "{{ git_user.group }}"
mode: '0755' mode: 0755
- name: Create Config Directory - name: Create Config Directory
file: file:
@ -26,7 +33,7 @@
state: directory state: directory
owner: "{{ git_user.uid }}" owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}" group: "{{ git_user.group }}"
mode: '0755' mode: 0755
- name: Start Docker Daemon - name: Start Docker Daemon
systemd: systemd:
@ -38,25 +45,17 @@
ansible.builtin.template: ansible.builtin.template:
src: environment.env.j2 src: environment.env.j2
dest: "/opt/gitea/environment.env" dest: "/opt/gitea/environment.env"
owner: "{{ git_user.name }}" owner: root
mode: '600' 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 - name: Create Gitea container
community.docker.docker_container: community.docker.docker_compose:
name: gitea project_src: /opt/gitea
image: "gitea:{{ gitea_vars['version'] }}-rootless" state: present
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"

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 }}"