Merge "Add docker login support"

This commit is contained in:
Zuul 2019-06-25 22:32:28 +00:00 committed by Gerrit Code Review
commit 54526ccde7
3 changed files with 16 additions and 0 deletions

View File

@ -57,6 +57,10 @@ Role Variables
* - `container_registry_skip_reconfiguration`
- `false`
- Do not perform container registry reconfiguration if it's already configured
* - `container_registry_logins`
- `[]`
- A dictionary containing registries and a username and a password associated with the registry.
Example: {'docker.io': {'myusername': 'mypassword'}, 'registry.example.com:8787': {'otheruser': 'otherpass'}}
Requirements
------------

View File

@ -14,3 +14,4 @@ container_registry_storage_options: '-s overlay2'
container_registry_selinux: false
container_registry_additional_sockets: []
container_registry_skip_reconfiguration: false
container_registry_logins: {}

11
tasks/docker-login.yml Normal file
View File

@ -0,0 +1,11 @@
# tasks file for ansible-role-container-registry
- name: perform docker login
become: true
docker_login:
username: "{{ lookup('dict', item.value).key }}"
password: "{{ lookup('dict', item.value).value }}"
registry: "{{ item.key }}"
loop: "{{ lookup('dict', container_registry_logins) }}"
when: container_registry_logins | length > 0