summaryrefslogtreecommitdiffstats
path: root/roles/container_runtime/tasks/registry_auth.yml
diff options
context:
space:
mode:
authorMichael Gugino <mgugino@redhat.com>2017-11-16 14:56:14 -0500
committerMichael Gugino <mgugino@redhat.com>2017-12-01 12:32:39 -0500
commit5120f8e90c0178ac7f6d911159ceb278dd87b4c9 (patch)
tree1b1f51b242c259e659e1e09c439504b33d33f0c1 /roles/container_runtime/tasks/registry_auth.yml
parente0e10698184c9a7cf4bf65787771686e46d26603 (diff)
downloadopenshift-5120f8e90c0178ac7f6d911159ceb278dd87b4c9.tar.gz
openshift-5120f8e90c0178ac7f6d911159ceb278dd87b4c9.tar.bz2
openshift-5120f8e90c0178ac7f6d911159ceb278dd87b4c9.tar.xz
openshift-5120f8e90c0178ac7f6d911159ceb278dd87b4c9.zip
Implement container runtime role
Diffstat (limited to 'roles/container_runtime/tasks/registry_auth.yml')
-rw-r--r--roles/container_runtime/tasks/registry_auth.yml32
1 files changed, 32 insertions, 0 deletions
diff --git a/roles/container_runtime/tasks/registry_auth.yml b/roles/container_runtime/tasks/registry_auth.yml
new file mode 100644
index 000000000..2c7bc5711
--- /dev/null
+++ b/roles/container_runtime/tasks/registry_auth.yml
@@ -0,0 +1,32 @@
+---
+- name: Check for credentials file for registry auth
+ stat:
+ path: "{{ docker_cli_auth_config_path }}/config.json"
+ when: oreg_auth_user is defined
+ register: docker_cli_auth_credentials_stat
+
+- name: Create credentials for docker cli registry auth
+ command: "docker --config={{ docker_cli_auth_config_path }} login -u {{ oreg_auth_user }} -p {{ oreg_auth_password }} {{ oreg_host }}"
+ register: openshift_docker_credentials_create_res
+ retries: 3
+ delay: 5
+ until: openshift_docker_credentials_create_res.rc == 0
+ when:
+ - not openshift_docker_alternative_creds | bool
+ - oreg_auth_user is defined
+ - (not docker_cli_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace) | bool
+
+# docker_creds is a custom module from lib_utils
+# 'docker login' requires a docker.service running on the local host, this is an
+# alternative implementation for non-docker hosts. This implementation does not
+# check the registry to determine whether or not the credentials will work.
+- name: Create credentials for docker cli registry auth (alternative)
+ docker_creds:
+ path: "{{ docker_cli_auth_config_path }}"
+ registry: "{{ oreg_host }}"
+ username: "{{ oreg_auth_user }}"
+ password: "{{ oreg_auth_password }}"
+ when:
+ - openshift_docker_alternative_creds | bool
+ - oreg_auth_user is defined
+ - (not docker_cli_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace) | bool