Ansible role to deploy a container registry
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

30 lines
989 B

---
# TODO(gcerami): The login process does not work with dockerhub, as dockerhub requires an
# auth API call to pass an email address (aven a fake one)
- name: Fail if credentials are not defined or empty
fail:
msg: "Registry credentials are missing"
when: container_registry_logins|default({}) == {}
- import_tasks: install-engine.yml
- name: Try docker command line for authentication
block:
- name: Login via docker command
become: true
command: >
docker login "{{ item.key }}"
--username "{{ lookup('dict', item.value).key }}"
--password "{{ lookup('dict', item.value).value }}"
loop: "{{ query('dict', container_registry_logins | default({})) }}"
register: registry_login_docker
changed_when: false
rescue:
- name: Failed login
debug:
msg: "Warning: login failed for some credentials while using docker login"
- import_tasks: cleanup-engine.yml
when: container_registry_cleanup_client