1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- ---
- # Fact setting
- - name: Set default image variables based on deployment type
- include_vars: "{{ item }}"
- with_first_found:
- - "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- - "default_images.yml"
- - name: Set openshift_web_console facts
- set_fact:
- openshift_web_console_prefix: "{{ openshift_web_console_prefix | default(__openshift_web_console_prefix) }}"
- openshift_web_console_version: "{{ openshift_web_console_version | default(__openshift_web_console_version) }}"
- openshift_web_console_image_name: "{{ openshift_web_console_image_name | default(__openshift_web_console_image_name) }}"
- # Default the replica count to the number of masters.
- openshift_web_console_replica_count: "{{ openshift_web_console_replica_count | default(groups.oo_masters_to_config | length) }}"
- - name: Ensure openshift-web-console project exists
- oc_project:
- name: openshift-web-console
- state: present
- - name: Make temp directory for asset config files
- command: mktemp -d /tmp/console-ansible-XXXXXX
- register: mktemp
- changed_when: False
- - name: Copy asset config template to temp directory
- copy:
- src: "{{ __console_files_location }}/{{ item }}"
- dest: "{{ mktemp.stdout }}/{{ item }}"
- with_items:
- - "{{ __console_template_file }}"
- - "{{ __console_config_file }}"
- - name: Update asset config properties
- yedit:
- src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
- edits:
- - key: logoutURL
- value: "{{ openshift.master.logout_url | default('') }}"
- - key: publicURL
- # Must have a trailing slash
- value: "{{ openshift.master.public_console_url }}/"
- - key: masterPublicURL
- value: "{{ openshift.master.public_api_url }}"
- - slurp:
- src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
- register: config
- - name: Apply template file
- shell: >
- {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_template_file }}"
- --param API_SERVER_CONFIG="{{ config['content'] | b64decode }}"
- --param IMAGE="{{ openshift_web_console_prefix }}{{ openshift_web_console_image_name }}:{{ openshift_web_console_version }}"
- --param NODE_SELECTOR={{ openshift_web_console_nodeselector | to_json | quote }}
- --param REPLICA_COUNT="{{ openshift_web_console_replica_count }}"
- | {{ openshift_client_binary }} apply -f -
- - name: Verify that the web console is running
- command: >
- curl -k https://webconsole.openshift-web-console.svc/healthz
- args:
- # Disables the following warning:
- # Consider using get_url or uri module rather than running curl
- warn: no
- register: console_health
- until: console_health.stdout == 'ok'
- retries: 120
- delay: 1
- changed_when: false
- - name: Remove temp directory
- file:
- state: absent
- name: "{{ mktemp.stdout }}"
- changed_when: False
|