diff --git a/ansible/post-deploy.yml b/ansible/post-deploy.yml index 97daa0b..e933330 100644 --- a/ansible/post-deploy.yml +++ b/ansible/post-deploy.yml @@ -74,11 +74,9 @@ become: true - name: Check if the public key is already in place - lineinfile: - path: /var/lib/gitea/git/.ssh/authorized_keys - regexp: "^{{ git_id_rsa_pub.stdout }}" - state: absent - check_mode: true + command: 'grep -Fxq "{{ git_id_rsa_pub.stdout}}" /var/lib/gitea/git/.ssh/authorized_keys' + check_mode: false + ignore_errors: true changed_when: false register: git_id_rsa_pub_check @@ -94,7 +92,7 @@ backup: true marker: "# ansible inserted git <-> gitea public key" become: true - when: git_id_rsa_pub_check.found + when: git_id_rsa_pub_check.rc == 0 - name: Symlink the gitea authorized keys configuration to the host git user file: