dedizierter User

This commit is contained in:
Marius Alwan Meyer 2022-11-08 11:46:39 +01:00
parent 90f441a234
commit 9dc7ae14e8

View File

@ -7,22 +7,43 @@
- docker.io - docker.io
- python3-docker - python3-docker
- name: Create git USER
ansible.builtin.user:
name: git
register: git_user
- name: Create Data Directory - name: Create Data Directory
file: file:
path: /data path: "{{ git_user.home }}/gitea/data"
state: directory state: directory
owner: 1000 owner: "{{ git_user.uid }}"
group: 1000 group: "{{ git_user.group }}"
mode: '0755' mode: '0755'
- name: Create Config Directory - name: Create Config Directory
file: file:
path: /config path: "{{ git_user.home }}/gitea/config"
state: directory state: directory
owner: 1000 owner: "{{ git_user.uid }}"
group: 1000 group: "{{ git_user.group }}"
mode: '0755' mode: '0755'
- name: Create SSH Directory
file:
path: "{{ git_user.home }}/gitea/ssh"
state: directory
owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}"
mode: '0755'
- name: Create SSH authorized_keys
file:
path: "{{ git_user.home }}/gitea/ssh/authorized_keys"
state: touch
owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}"
mode: '0600'
- name: Start Docker Daemon - name: Start Docker Daemon
systemd: systemd:
name: docker name: docker
@ -39,13 +60,20 @@
env: strict env: strict
restart_policy: unless-stopped restart_policy: unless-stopped
volumes: volumes:
- /data:/var/lib/gitea - "{{ git_user.home }}/gitea/data:/var/lib/gitea"
- /config:/etc/gitea - "{{ git_user.home }}/gitea/ssh:/var/lib/gitea/git/.ssh"
- "{{ git_user.home }}/gitea/config:/etc/gitea"
#- /data:/var/lib/gitea
#- /config:/etc/gitea
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
ports: ports:
- "3000:3000" - "3000:3000"
- "22:2222" - "22:2222"
user: "{{ git_user.uid }}:{{ git_user.group }}"
env:
USER_UID: "{{ git_user.uid }}"
USER_GID: "{{ git_user.group }}"