Implement ssh config of gitea role

This commit is contained in:
uumas
2022-03-10 09:05:33 +02:00
parent ef9e2cdee5
commit b63efbf66b
6 changed files with 40 additions and 2 deletions

View File

@@ -8,7 +8,12 @@ dependencies:
docker_database: postgres
docker_volumes:
- gitea_data:/data
- /var/lib/gitea/.ssh/:/data/git/.ssh
docker_published_ports:
- "127.0.0.1:{{ ports.gitea.ssh }}:22"
docker_env:
USER_UID: '2132'
USER_GID: '2132'
GITEA__database__DB_TYPE: postgres
GITEA__database__USER: gitea
GITEA__database__HOST: gitea_db:5432

View File

@@ -0,0 +1,28 @@
---
- name: Create git group on host for gitea ssh
group:
name: git
gid: 2132
system: yes
- name: Create git user on host for gitea ssh
user:
name: git
uid: 2132
group: git
system: yes
home: /var/lib/gitea
generate_ssh_key: yes
register: git_user
- name: Add git user's own ssh key to its authorized keys
authorized_key:
user: git
key: "{{ git_user.ssh_public_key }}"
- name: Put gitea ssh forwarder in place
template:
src: gitea_ssh_forward.j2
dest: /usr/local/bin/gitea
mode: '755'

View File

@@ -0,0 +1,2 @@
#!/bin/sh
ssh -p {{ ports.gitea.ssh }} -o StrictHostKeyChecking=no git@127.0.0.1 "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"