summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master/tasks/registry_auth.yml
diff options
context:
space:
mode:
authorMichael Gugino <mgugino@redhat.com>2017-09-22 10:37:54 -0400
committerMichael Gugino <mgugino@redhat.com>2017-09-22 10:42:24 -0400
commit3d9af759fe9e69f0b4a83e69e16d7a5bd0d56b6f (patch)
treeddc0ac274ee50464a5e2bc82ab1259708bb27ba4 /roles/openshift_master/tasks/registry_auth.yml
parent91c1c6fc7323ca885956102248b2e5b18e5332c3 (diff)
downloadopenshift-3d9af759fe9e69f0b4a83e69e16d7a5bd0d56b6f.tar.gz
openshift-3d9af759fe9e69f0b4a83e69e16d7a5bd0d56b6f.tar.bz2
openshift-3d9af759fe9e69f0b4a83e69e16d7a5bd0d56b6f.tar.xz
openshift-3d9af759fe9e69f0b4a83e69e16d7a5bd0d56b6f.zip
Fix registry_auth logic for upgrades
Currently, the logic for registry authentication is not implemented correctly to account for upgrades of containerized hosts. Additionally, the logic to account for multiple runs of openshift-ansible might cause registry authentication credentials to not be mounted inside of containerized hosts. This commit adds the necessary logic to ensure containerized hosts retain registry credentials. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1494470
Diffstat (limited to 'roles/openshift_master/tasks/registry_auth.yml')
-rw-r--r--roles/openshift_master/tasks/registry_auth.yml30
1 files changed, 19 insertions, 11 deletions
diff --git a/roles/openshift_master/tasks/registry_auth.yml b/roles/openshift_master/tasks/registry_auth.yml
index 96b6c614e..2644f235e 100644
--- a/roles/openshift_master/tasks/registry_auth.yml
+++ b/roles/openshift_master/tasks/registry_auth.yml
@@ -1,27 +1,35 @@
---
+# We need to setup some variables as this play might be called directly
+# from outside of the role.
+- set_fact:
+ oreg_auth_credentials_path: "{{ r_openshift_master_data_dir }}/.docker"
+ when: oreg_auth_credentials_path is not defined
+
+- set_fact:
+ oreg_host: "{{ oreg_url.split('/')[0] if (oreg_url is defined and '.' in oreg_url.split('/')[0]) else '' }}"
+ when: oreg_host is not defined
+
- name: Check for credentials file for registry auth
stat:
path: "{{ oreg_auth_credentials_path }}"
when: oreg_auth_user is defined
register: master_oreg_auth_credentials_stat
-# Container images may need the registry credentials
-- name: Setup ro mount of /root/.docker for containerized hosts
- set_fact:
- l_bind_docker_reg_auth: True
+- name: Create credentials for registry auth
+ command: "docker --config={{ oreg_auth_credentials_path }} login -u {{ oreg_auth_user }} -p {{ oreg_auth_password }} {{ oreg_host }}"
when:
- - openshift.common.is_containerized | bool
- oreg_auth_user is defined
- (not master_oreg_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace) | bool
+ register: master_oreg_auth_credentials_create
notify:
- restart master api
- restart master controllers
-- name: Create credentials for registry auth
- command: "docker --config={{ oreg_auth_credentials_path }} login -u {{ oreg_auth_user }} -p {{ oreg_auth_password }} {{ oreg_host }}"
+# Container images may need the registry credentials
+- name: Setup ro mount of /root/.docker for containerized hosts
+ set_fact:
+ l_bind_docker_reg_auth: True
when:
+ - openshift.common.is_containerized | bool
- oreg_auth_user is defined
- - (not master_oreg_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace) | bool
- notify:
- - restart master api
- - restart master controllers
+ - (master_oreg_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace or master_oreg_auth_credentials_create.changed) | bool