Try slurp

This commit is contained in:
Luke Murphy 2020-03-23 21:22:57 +01:00
parent 53dc7dd107
commit 0dba3a883a
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 12 additions and 6 deletions

View File

@ -8,17 +8,23 @@
extensions:
- yml
- name: Retrieve git user ssh public key
set_fact:
git_ssh_pub_key: "{{ lookup('file', '/home/git/.ssh/id_rsa.pub') }}"
git_auth_keys: "{{ lookup('file', '/var/lib/gitea/git/.ssh/authorized_keys') }}"
- name: Slurp the git user ssh public key
slurp:
src: /home/git/.ssh/id_rsa.pub
register: git_id_rsa
become: true
- name: Slurp the git user ssh authorized_keys
slurp:
src: /var/lib/gitea/git/.ssh/authorized_keys
register: git_auth_keys
become: true
- name: TEST TEST TEST
lineinfile:
path: /var/lib/gitea/git/.ssh/authorized_keys
regexp: "^{{ git_ssh_pub_key }}"
line: "{{ git_ssh_pub_key }}{{ git_auth_keys }}"
regexp: "^{{ git_id_rsa['content'] }}"
line: "{{ git_id_rsa['content'] }}{{ git_auth_keys['content'] }}"
state: present
create: true
become: true