Try to fix the git <-> gitea public key SSH issue
This commit is contained in:
parent
0bf9dde333
commit
eabbcf8eed
@ -63,18 +63,30 @@
|
|||||||
force: true
|
force: true
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
# TODO(decentral1se): make this work...
|
- name: Store the git user public key
|
||||||
# - name: Set authorized_keys file for git user
|
shell: cat /home/git/.ssh/id_rsa.pub
|
||||||
# lineinfile:
|
register: git_id_rsa_pub
|
||||||
# path: /var/lib/gitea/git/.ssh/authorized_keys
|
become: true
|
||||||
# regexp: "^{{ lookup('file', '/home/git/.ssh/id_rsa.pub') }}"
|
|
||||||
# line: "{{ lookup('file', '/home/git/.ssh/id_rsa.pub') }}{{ lookup('file', '/var/lib/gitea/git/.ssh/authorized_keys') }}"
|
|
||||||
# state: present
|
|
||||||
# insertbefore: BOF
|
|
||||||
# create: true
|
|
||||||
# become: true
|
|
||||||
|
|
||||||
- name: Symlink the authorized keys configuration
|
- name: Store the gitea authorized_keys file
|
||||||
|
shell: cat /var/lib/gitea/git/.ssh/authorized_keys
|
||||||
|
register: git_auth_keys
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Ensure git public key is in gitea loaded authorized_keys
|
||||||
|
blockinfile:
|
||||||
|
path: /var/lib/gitea/git/.ssh/authorized_keys
|
||||||
|
block: "{{ git_id_rsa_pub.stdout }}"
|
||||||
|
state: present
|
||||||
|
owner: git
|
||||||
|
group: git
|
||||||
|
create: true
|
||||||
|
insertbefore: BOF
|
||||||
|
backup: true
|
||||||
|
marker: "# ansible inserted git <-> gitea public key"
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Symlink the gitea authorized keys configuration to the host git user
|
||||||
file:
|
file:
|
||||||
src: /var/lib/gitea/git/.ssh/authorized_keys
|
src: /var/lib/gitea/git/.ssh/authorized_keys
|
||||||
dest: /home/git/.ssh/authorized_keys
|
dest: /home/git/.ssh/authorized_keys
|
||||||
|
Reference in New Issue
Block a user