install.yml 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. - key: extensions#scriptURLs
  47. value: "{{ openshift_web_console_extension_script_urls | default([]) }}"
  48. - key: extensions#stylesheetURLs
  49. value: "{{ openshift_web_console_extension_stylesheet_urls | default([]) }}"
  50. - key: extensions#properties
  51. value: "{{ openshift_web_console_extension_properties | default({}) }}"
  52. separator: '#'
  53. state: present
  54. - slurp:
  55. src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
  56. register: config
  57. - name: Reconcile with the web console RBAC file
  58. shell: >
  59. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_rbac_file }}" | {{ openshift_client_binary }} auth reconcile -f -
  60. - name: Apply the web console template file
  61. shell: >
  62. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_template_file }}"
  63. --param API_SERVER_CONFIG="{{ config['content'] | b64decode }}"
  64. --param IMAGE="{{ openshift_web_console_prefix }}{{ openshift_web_console_image_name }}:{{ openshift_web_console_version }}"
  65. --param NODE_SELECTOR={{ openshift_web_console_nodeselector | to_json | quote }}
  66. --param REPLICA_COUNT="{{ openshift_web_console_replica_count }}"
  67. | {{ openshift_client_binary }} apply -f -
  68. - name: Verify that the web console is running
  69. command: >
  70. curl -k https://webconsole.openshift-web-console.svc/healthz
  71. args:
  72. # Disables the following warning:
  73. # Consider using get_url or uri module rather than running curl
  74. warn: no
  75. register: console_health
  76. until: console_health.stdout == 'ok'
  77. retries: 120
  78. delay: 1
  79. changed_when: false
  80. - name: Remove temp directory
  81. file:
  82. state: absent
  83. name: "{{ mktemp.stdout }}"
  84. changed_when: False