install.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. node_selector:
  20. - ""
  21. - name: Make temp directory for the web console config files
  22. command: mktemp -d /tmp/console-ansible-XXXXXX
  23. register: mktemp
  24. changed_when: False
  25. - name: Copy the web console config template to temp directory
  26. copy:
  27. src: "{{ __console_files_location }}/{{ item }}"
  28. dest: "{{ mktemp.stdout }}/{{ item }}"
  29. with_items:
  30. - "{{ __console_template_file }}"
  31. - "{{ __console_rbac_file }}"
  32. - "{{ __console_config_file }}"
  33. - name: Update the web console config properties
  34. yedit:
  35. src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
  36. edits:
  37. - key: clusterInfo#consolePublicURL
  38. # Must have a trailing slash
  39. value: "{{ openshift.master.public_console_url }}/"
  40. - key: clusterInfo#masterPublicURL
  41. value: "{{ openshift.master.public_api_url }}"
  42. - key: clusterInfo#logoutPublicURL
  43. value: "{{ openshift.master.logout_url | default('') }}"
  44. - key: features#inactivityTimeoutMinutes
  45. value: "{{ openshift_web_console_inactivity_timeout_minutes | default(0) }}"
  46. # TODO: The new extensions properties cannot be set until
  47. # origin-web-console-server has been updated with the API changes since
  48. # `extensions` in the old asset config was an array.
  49. # - key: extensions#scriptURLs
  50. # value: "{{ openshift_web_console_extension_script_urls | default([]) }}"
  51. # - key: extensions#stylesheetURLs
  52. # value: "{{ openshift_web_console_extension_stylesheet_urls | default([]) }}"
  53. # - key: extensions#properties
  54. # value: "{{ openshift_web_console_extension_properties | default({}) }}"
  55. # DEPRECATED PROPERTIES
  56. # These properties have been renamed and will be removed from the install
  57. # in a future pull. Keep both the old and new properties for now so that
  58. # the install is not broken while the origin-web-console image is updated.
  59. - key: publicURL
  60. # Must have a trailing slash
  61. value: "{{ openshift.master.public_console_url }}/"
  62. - key: logoutURL
  63. value: "{{ openshift.master.logout_url | default('') }}"
  64. - key: masterPublicURL
  65. value: "{{ openshift.master.public_api_url }}"
  66. separator: '#'
  67. state: present
  68. - slurp:
  69. src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
  70. register: config
  71. - name: Reconcile with the web console RBAC file
  72. shell: >
  73. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_rbac_file }}" | {{ openshift_client_binary }} auth reconcile -f -
  74. - name: Apply the web console template file
  75. shell: >
  76. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_template_file }}"
  77. --param API_SERVER_CONFIG="{{ config['content'] | b64decode }}"
  78. --param IMAGE="{{ openshift_web_console_prefix }}{{ openshift_web_console_image_name }}:{{ openshift_web_console_version }}"
  79. --param NODE_SELECTOR={{ openshift_web_console_nodeselector | to_json | quote }}
  80. --param REPLICA_COUNT="{{ openshift_web_console_replica_count }}"
  81. | {{ openshift_client_binary }} apply -f -
  82. - name: Verify that the web console is running
  83. command: >
  84. curl -k https://webconsole.openshift-web-console.svc/healthz
  85. args:
  86. # Disables the following warning:
  87. # Consider using get_url or uri module rather than running curl
  88. warn: no
  89. register: console_health
  90. until: console_health.stdout == 'ok'
  91. retries: 120
  92. delay: 1
  93. changed_when: false
  94. - name: Remove temp directory
  95. file:
  96. state: absent
  97. name: "{{ mktemp.stdout }}"
  98. changed_when: False