Unable to combine docker_login with credential store

64 views
Skip to first unread message

Jonas Audenaert

unread,
Mar 3, 2020, 4:06:15 AM3/3/20
to Ansible Project
Hello, I'm using ansible 2.9 to install Docker on a remote RedHat, create a docker credential store with pass and pull several images from private docker registries.
After the run of my playbook installing docker, docker credential store, etc. I remove the config.json of the .docker directory so it will re-initialize during the next docker login.

After this I use following ansible task to make a docker login:

- name: Logon
  docker_login
:
    registry
: my-private-registry.on.my.internal.site
    username
: myaccount
    password
: "{{passwordvar}}"
  become
: yes

This fails because it generates plain text content in my config.json.
{
     
"auths": {
         
"my-private-registroy.on.my.internal.site": {
               
"auth": "U9ZjQWNjdC10cmF4LAJuZC1jaTpBKzVyWFYwSF8tNnEqcTkf",
               
"email": null
         
}
     
}
}

When I remove manually the config.json file and use the docker login command on the server itself, I get what I wanted.
{
 
"auths": {
 
"my-private-registroy.on.my.internal.site": {}
 
},
 
"HttpHeaders": {
 
"User-Agent": "Docker-Client/19.03.6 (linux)"
 
},
 
"credsStore": "pass"
}

Why is it not working with my ansible task?

Felix Fontein

unread,
Mar 3, 2020, 5:00:42 AM3/3/20
to ansible...@googlegroups.com
Hi,

docker_login will only support credential stores in Ansible 2.10 (see
https://github.com/ansible/ansible/pull/63158).

You can try to use the new version of the module
(https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/docker/docker_login.py)
with Ansible 2.9 if you need support for that now.

Cheers,
Felix



On Tue, 3 Mar 2020 01:06:15 -0800 (PST)
Jonas Audenaert <jonas.a...@gmail.com> wrote:

> Hello, I'm using ansible 2.9 to install Docker on a remote RedHat,
> create a docker credential store with pass and pull several images
> from private docker registries.
> After the run of my playbook installing docker, docker credential
> store, etc. I remove the config.json of the *.docker *directory so it
Reply all
Reply to author
Forward
0 new messages