1
0
mirror of https://github.com/openshift/openshift-ansible.git synced 2026-02-05 06:46:04 +01:00

Construct openshift_bootstrap_endpoint from cluster config CRDs if kubeconfig_path is set

This commit is contained in:
Vadim Rutkovsky
2019-02-18 11:58:51 +01:00
parent 330d9a2da6
commit a19f0cd172

View File

@@ -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: