install.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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: logoutURL
  38. value: "{{ openshift.master.logout_url | default('') }}"
  39. - key: publicURL
  40. # Must have a trailing slash
  41. value: "{{ openshift.master.public_console_url }}/"
  42. - key: masterPublicURL
  43. value: "{{ openshift.master.public_api_url }}"
  44. - slurp:
  45. src: "{{ mktemp.stdout }}/{{ __console_config_file }}"
  46. register: config
  47. - name: Reconcile with the web console RBAC file
  48. shell: >
  49. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_rbac_file }}" | {{ openshift_client_binary }} auth reconcile -f -
  50. - name: Apply the web console template file
  51. shell: >
  52. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __console_template_file }}"
  53. --param API_SERVER_CONFIG="{{ config['content'] | b64decode }}"
  54. --param IMAGE="{{ openshift_web_console_prefix }}{{ openshift_web_console_image_name }}:{{ openshift_web_console_version }}"
  55. --param NODE_SELECTOR={{ openshift_web_console_nodeselector | to_json | quote }}
  56. --param REPLICA_COUNT="{{ openshift_web_console_replica_count }}"
  57. | {{ openshift_client_binary }} apply -f -
  58. - name: Verify that the web console is running
  59. command: >
  60. curl -k https://webconsole.openshift-web-console.svc/healthz
  61. args:
  62. # Disables the following warning:
  63. # Consider using get_url or uri module rather than running curl
  64. warn: no
  65. register: console_health
  66. until: console_health.stdout == 'ok'
  67. retries: 120
  68. delay: 1
  69. changed_when: false
  70. - name: Remove temp directory
  71. file:
  72. state: absent
  73. name: "{{ mktemp.stdout }}"
  74. changed_when: False