I am trying to log into private docker container registry and I need to use 
a json-string as a password. So I do the following
docker_login:
  registry: cr.yandex
  username: json_key
  password: "{{ lookup('file', 'key.json') }}"
  reauthorize: yes
And I got an error "Get https://cr.yandex/v2/: unauthorized: Password is 
invalid - must be JSON key".

When I ran "ansible-playbook" in verbose mode I saw that the content of the 
file "key.json" was transcoded – double quotes were changed to single 
quotes so it have become an invalid json string.

Luckily I found a code that caused this 
behaviour: 
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/docker/docker_login.py#L318.
 
The "password" is of type "string". Then I changed "type='str'" to 
"type='json'" in my local file and everything worked!

I don't know if I am doing something wrong or it is a real bug and I should 
create an issue on github. Could someone please help me?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/c7e66310-2465-4f5c-bfdf-7a421338a754%40googlegroups.com.

Reply via email to