diff --git a/ansible/post-deploy.yml b/ansible/post-deploy.yml index 6ff12fd..9af6c0d 100644 --- a/ansible/post-deploy.yml +++ b/ansible/post-deploy.yml @@ -40,3 +40,11 @@ mappings: - "https:443:3000" 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 diff --git a/ansible/pre-deploy.yml b/ansible/pre-deploy.yml index 14b4518..59b511b 100644 --- a/ansible/pre-deploy.yml +++ b/ansible/pre-deploy.yml @@ -26,20 +26,13 @@ name: gitea service: mariadb - - name: Setup host Gitea group - group: - name: gitea - system: true - state: present - become: true - - - name: Setup host Gitea user + - name: Setup host git user user: - name: gitea + name: git comment: gitea user create_home: true - home: /var/lib/gitea - group: gitea + home: /home/git + group: git system: true state: present generate_ssh_key: true @@ -47,29 +40,31 @@ ssh_key_file: .ssh/id_rsa become: true - - name: Create SSH passthrough directories + - name: Create application directories file: path: "{{ item }}" state: directory - owner: gitea - group: gitea + owner: git + group: git with_items: - /app - /app/gitea + - /var/lib/gitea become: true - - name: Setup the SSH passthrough + - name: Setup the SSH passthrough script template: src: gitea.j2 dest: /app/gitea/gitea - owner: gitea - group: gitea + owner: git + group: git + mode: "+x" become: true - - name: Get uid/guid of the gitea user + - name: Get uid/guid of the git user getent: database: passwd - key: gitea + key: git split: ":" become: true