Switch to system git user

This commit is contained in:
Luke Murphy 2020-03-23 16:21:12 +01:00
parent 78994e5fe9
commit e38c34ee6a
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 22 additions and 19 deletions

View File

@ -40,3 +40,11 @@
mappings: mappings:
- "https:443:3000" - "https:443:3000"
state: present state: present
- name: Symlink the authorized keys configuration
file:
src: /var/lib/gitea/git/.ssh/authorized_keys
dest: /home/git/.ssh/authorized_keys
state: link
force: true
owner: git

View File

@ -26,20 +26,13 @@
name: gitea name: gitea
service: mariadb service: mariadb
- name: Setup host Gitea group - name: Setup host git user
group:
name: gitea
system: true
state: present
become: true
- name: Setup host Gitea user
user: user:
name: gitea name: git
comment: gitea user comment: gitea user
create_home: true create_home: true
home: /var/lib/gitea home: /home/git
group: gitea group: git
system: true system: true
state: present state: present
generate_ssh_key: true generate_ssh_key: true
@ -47,29 +40,31 @@
ssh_key_file: .ssh/id_rsa ssh_key_file: .ssh/id_rsa
become: true become: true
- name: Create SSH passthrough directories - name: Create application directories
file: file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
owner: gitea owner: git
group: gitea group: git
with_items: with_items:
- /app - /app
- /app/gitea - /app/gitea
- /var/lib/gitea
become: true become: true
- name: Setup the SSH passthrough - name: Setup the SSH passthrough script
template: template:
src: gitea.j2 src: gitea.j2
dest: /app/gitea/gitea dest: /app/gitea/gitea
owner: gitea owner: git
group: gitea group: git
mode: "+x"
become: true become: true
- name: Get uid/guid of the gitea user - name: Get uid/guid of the git user
getent: getent:
database: passwd database: passwd
key: gitea key: git
split: ":" split: ":"
become: true become: true