From a19f0cd172e226efbd95caf32ed5042b0d7e468f Mon Sep 17 00:00:00 2001 From: Vadim Rutkovsky Date: Mon, 18 Feb 2019 11:58:51 +0100 Subject: [PATCH] Construct openshift_bootstrap_endpoint from cluster config CRDs if kubeconfig_path is set --- playbooks/init/basic_facts.yml | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/playbooks/init/basic_facts.yml b/playbooks/init/basic_facts.yml index f15ce97fc..1e5765983 100644 --- a/playbooks/init/basic_facts.yml +++ b/playbooks/init/basic_facts.yml @@ -30,6 +30,46 @@ - openshift_deployment_type is undefined - deployment_type is defined +- name: Read API URL from infra config + hosts: "{{ l_init_fact_hosts | default('nodes') }}" + tasks: + - oc_obj: + name: cluster + kind: infrastructures.config.openshift.io + kubeconfig: "{{ kubeconfig_path }}" + state: present + register: clustercfg + when: kubeconfig_path is defined + until: + - clustercfg.results is defined + - clustercfg.results.returncode is defined + - clustercfg.results.returncode == 0 + - clustercfg.results.results is defined + - clustercfg.results.results | length > 0 + retries: 36 + delay: 5 + delegate_to: localhost + - set_fact: + openshift_api_prefix: "{{ clustercfg.results.results[0].status.apiServerURL.split(':')[0:-1] | join(':') }}" + +- name: Set worker openshift_bootstrap_endpoint if not already defined + hosts: "{{ l_init_fact_hosts | default('nodes') }}:!masters:!bootstrap" + tasks: + - set_fact: + openshift_bootstrap_endpoint: "{{ openshift_api_prefix }}:22623/config/worker" + when: + - kubeconfig_path is defined + - openshift_bootstrap_endpoint is not defined + +- name: Set master openshift_bootstrap_endpoint if not already defined + hosts: "{{ l_init_fact_hosts | default('nodes') }}:&masters" + tasks: + - set_fact: + openshift_bootstrap_endpoint: "{{ openshift_api_prefix }}:22623/config/master" + when: + - kubeconfig_path is defined + - openshift_bootstrap_endpoint is not defined + - name: Read in openshift-install hosts: "{{ l_init_fact_hosts | default('nodes') }}" tasks: