From c665fb8442d01a2298930f7d950f2c106824e8a7 Mon Sep 17 00:00:00 2001 From: rr Date: Thu, 30 May 2024 08:50:17 +0200 Subject: [PATCH] fix(ansible): gcr registry login Signed-off-by: rr --- ansible/docker_image_push.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ansible/docker_image_push.yml b/ansible/docker_image_push.yml index ec68422e93..59bc19980e 100644 --- a/ansible/docker_image_push.yml +++ b/ansible/docker_image_push.yml @@ -2,6 +2,8 @@ - name: "Push docker images to any docker registry" hosts: local become: yes + vars: + service_account_local_path: /tmp/gcr_service_account_key.json vars_files: - ["{{inventory_dir}}/secrets.yml"] tasks: @@ -15,16 +17,16 @@ - name: Write GCR service account key to a temporary file copy: content: "{{ gcp_service_account }}" - dest: /tmp/gcr_service_account_key.json + dest: "{{ service_account_local_path }}" - name: Authenticate Docker to GCR - command: > - docker login -u _json_key -p "{{ lookup('file', '/tmp/gcr_service_account_key.json') }}" https://gcr.io + shell: > + cat "{{ service_account_local_path }}" | docker login -u _json_key --password-stdin {{ vault_docker_registry_url }} no_log: true - name: Remove temporary GCR service account key file file: - path: /tmp/gcr_service_account_key.json + path: "{{ service_account_local_path}}" state: absent tags: gcp