That is a neat trick :) will try it next time I'm around GCP project.

Thanks Julien!

On June 19, 2017 6:25:41 AM PDT, julien singler <[email protected]> 
wrote:
>Hi Dmitry,
>
>Almost a year after you, I've the same problem. I guess you fixed your 
>problem another way, but for anyone that is currently in the same 
>situation, I found a trick to not let the lookup interpret your json ..
>
>
>By digging on this forum 
>: https://groups.google.com/forum/#!topic/ansible-devel/2C7pl2_kxlY
>They suggests to put a space between your double quote and the
>accolades : 
>gcloud_token: " {{lookup('file', gcloud_token_file)}}"
>
>And it's working fine with gcr .. No need for your filters like to_json
>and 
>quote.
>I hope it will help others :)
>Le vendredi 2 septembre 2016 01:03:18 UTC+2, Dmitry Makovey a écrit :
>>
>> is anyone using docker_login with Google Cloud Registry?
>>
>> I am attempting to do so by defining variable for auth token:
>>
>> gcloud_token_file: gcp_sa_account.json
>> gcloud_token: "{{ lookup('file', gcloud_token_file) }}"
>>
>> and then trying to login:
>>
>> docker_login: username="_json_key" password="{{ gcloud_token |
>to_json | 
>> quote }}" email="{{ docker_auth_email }}" registry="gcr.io"
>reauthorize=
>> "yes"
>>
>> it looks like ansible instead of picking up "raw" contents of the
>file 
>> auto-converts it into structure as soon as it notices JSON so I have
>to 
>> "un-convert" it with to_json, however as soon as I do that it seems
>like 
>> escaping/quoting goes out the window and I am unable to get login to
>work 
>> as expected. Using the same gcp_sa_account.json I can login just find
>using 
>>
>> docker login -e [email protected] -u _json_key -p "$(cat 
>> gcp_sa_account.json)" https://gcr.io
>>
>> I looked online and couldn't find any samples of people using it. is
>it 
>> just not meant to be functional with GCR?
>>
>
>-- 
>You received this message because you are subscribed to a topic in the
>Google Groups "Ansible Project" group.
>To unsubscribe from this topic, visit
>https://groups.google.com/d/topic/ansible-project/IT_LpPv0-nc/unsubscribe.
>To unsubscribe from this group and all its topics, send an email to
>[email protected].
>To post to this group, send email to [email protected].
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/ansible-project/9b8346a3-2601-492a-a2c9-6eed2035810e%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6AEDF445-8945-4765-9030-0C0E3B45EFD5%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to