From: Trevor Bramwell Date: Wed, 13 Mar 2019 22:41:12 +0000 (-0700) Subject: Fix uploading workshop user's ssh pubkey to Gerrit X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=85ec3aecfd60543a36a8c4ec325ceb547cfb1e12;p=releng%2Fci-workshop.git Fix uploading workshop user's ssh pubkey to Gerrit By default the 'uri' module will use "Content-Type: 'raw'", while Gerrit only accepts 'text/plain' when uploading sshkeys. Forcing basic auth also ensures the request passes username/password instead of looking for an 401 HTTP response before submitting the data. Change-Id: Idadfa50a4b6e81f6c8cfc5d6f839c53df8be5417 Signed-off-by: Trevor Bramwell --- diff --git a/init/playbooks/site.yaml b/init/playbooks/site.yaml index 60b8a8b..88ee798 100644 --- a/init/playbooks/site.yaml +++ b/init/playbooks/site.yaml @@ -23,16 +23,16 @@ method: 'POST' body: "username=workshop&password=workshop" status_code: 302 - - name: Remove ssh-rsa from sshkey - set_fact: - workshop_ssh_key_modified: "{{ lookup('file', '{{ workshop_ssh_keyfile }}.pub') }}" - name: Upload sshkey to Admin user uri: url: 'http://gerrit:8080/a/accounts/self/sshkeys' method: 'POST' user: 'workshop' password: 'workshop' - body: "{{ workshop_ssh_key_modified }}" + force_basic_auth: true + headers: + Content-Type: 'text/plain' + body: "{{ lookup('file', '{{ workshop_ssh_keyfile }}.pub') }}" status_code: 201 - name: Wait for Gerrit SSH Interface wait_for: