install.yml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ---
  2. # Fact setting
  3. - name: Set default image variables based on deployment type
  4. include_vars: "{{ item }}"
  5. with_first_found:
  6. - "{{ openshift_deployment_type | default(deployment_type) }}.yml"
  7. - "default_images.yml"
  8. - name: Set openshift_web_console facts
  9. set_fact:
  10. openshift_web_console_prefix: "{{ openshift_web_console_prefix | default(__openshift_web_console_prefix) }}"
  11. openshift_web_console_version: "{{ openshift_web_console_version | default(__openshift_web_console_version) }}"
  12. openshift_web_console_image_name: "{{ openshift_web_console_image_name | default(__openshift_web_console_image_name) }}"
  13. # Default the replica count to the number of masters.
  14. openshift_web_console_replica_count: "{{ openshift_web_console_replica_count | default(groups.oo_masters_to_config | length) }}"
  15. - name: Ensure openshift-web-console project exists
  16. oc_project:
  17. name: openshift-web-console
  18. state: present
  19. - name: Make temp directory for asset config files
  20. command: mktemp -d /tmp/console-ansible-XXXXXX
  21. register: mktemp
  22. changed_when: False
  23. - name: Copy asset config template to temp directory
  24. copy:
  25. src: "{{ __console_files_location }}/{{ item }}"
  26. dest: "{{ mktemp.stdout }}/{{ item }}"
  27. with_items:
  28. - "{{ __console_template_file }}"
  29. - "{{ __console_config_file }}"
  30. - name: Update asset config properties
  31. yedit:
  32. src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
  33. edits:
  34. - key: logoutURL
  35. value: "{{ openshift.master.logout_url | default('') }}"
  36. - key: publicURL
  37. # Must have a trailing slash
  38. value: "{{ openshift.master.public_console_url }}/"
  39. - key: masterPublicURL
  40. value: "{{ openshift.master.public_api_url }}"
  41. - slurp:
  42. src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
  43. register: config
  44. - name: Apply template file
  45. shell: >
  46. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_template_file }}"
  47. --param API_SERVER_CONFIG="{{ config['content'] | b64decode }}"
  48. --param IMAGE="{{ openshift_web_console_prefix }}{{ openshift_web_console_image_name }}:{{ openshift_web_console_version }}"
  49. --param NODE_SELECTOR={{ openshift_web_console_nodeselector | to_json | quote }}
  50. --param REPLICA_COUNT="{{ openshift_web_console_replica_count }}"
  51. | {{ openshift_client_binary }} apply -f -
  52. - name: Verify that the web console is running
  53. command: >
  54. curl -k https://webconsole.openshift-web-console.svc/healthz
  55. args:
  56. # Disables the following warning:
  57. # Consider using get_url or uri module rather than running curl
  58. warn: no
  59. register: console_health
  60. until: console_health.stdout == 'ok'
  61. retries: 120
  62. delay: 1
  63. changed_when: false
  64. - name: Remove temp directory
  65. file:
  66. state: absent
  67. name: "{{ mktemp.stdout }}"
  68. changed_when: False