main.yml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. ---
  2. # Ensure the default sub-domain is set:
  3. - name: Migrate legacy osm_default_subdomain fact
  4. set_fact:
  5. openshift_master_default_subdomain: "{{ osm_default_subdomain | default(None) }}"
  6. when: openshift_master_default_subdomain is not defined
  7. - name: Verify required variables are set
  8. fail:
  9. msg: openshift_master_default_subdomain must be set to deploy metrics
  10. when: openshift_hosted_metrics_deploy | default(false) | bool and openshift_master_default_subdomain | default("") == ""
  11. # NOTE: These metrics variables are unfortunately needed by both the master and the metrics roles
  12. # to properly configure the master-config.yaml file.
  13. #
  14. # NOTE: Today only changing the hostname for the metrics public URL is supported, the
  15. # path must stay consistent. As such if openshift_hosted_metrics_public_url is set in
  16. # inventory, we extract the hostname, and then reset openshift_hosted_metrics_public_url
  17. # to the format that we know is valid. (This may change in future)
  18. - name: Set g_metrics_hostname
  19. set_fact:
  20. g_metrics_hostname: "{{ openshift_hosted_metrics_public_url
  21. | default('hawkular-metrics.' ~ (openshift_master_default_subdomain))
  22. | oo_hostname_from_url }}"
  23. - set_fact:
  24. openshift_hosted_metrics_deploy_url: "https://{{ g_metrics_hostname }}/hawkular/metrics"
  25. when: (openshift_hosted_metrics_deploy | default(false) | bool) or (openshift_hosted_metrics_public_url is defined)
  26. - name: Set master facts
  27. openshift_facts:
  28. role: master
  29. local_facts:
  30. cluster_method: "{{ openshift_master_cluster_method | default('native') }}"
  31. cluster_hostname: "{{ openshift_master_cluster_hostname | default(None) }}"
  32. cluster_public_hostname: "{{ openshift_master_cluster_public_hostname | default(None) }}"
  33. api_port: "{{ openshift_master_api_port | default(None) }}"
  34. api_url: "{{ openshift_master_api_url | default(None) }}"
  35. api_use_ssl: "{{ openshift_master_api_use_ssl | default(None) }}"
  36. public_api_url: "{{ openshift_master_public_api_url | default(None) }}"
  37. console_path: "{{ openshift_master_console_path | default(None) }}"
  38. console_port: "{{ openshift_master_console_port | default(None) }}"
  39. console_url: "{{ openshift_master_console_url | default(None) }}"
  40. console_use_ssl: "{{ openshift_master_console_use_ssl | default(None) }}"
  41. public_console_url: "{{ openshift_master_public_console_url | default(None) }}"
  42. logging_public_url: "{{ openshift_master_logging_public_url | default(None) }}"
  43. logout_url: "{{ openshift_master_logout_url | default(None) }}"
  44. extension_scripts: "{{ openshift_master_extension_scripts | default(None) }}"
  45. extension_stylesheets: "{{ openshift_master_extension_stylesheets | default(None) }}"
  46. extensions: "{{ openshift_master_extensions | default(None) }}"
  47. etcd_hosts: "{{ openshift_master_etcd_hosts | default(None) }}"
  48. etcd_port: "{{ openshift_master_etcd_port | default(None) }}"
  49. etcd_use_ssl: "{{ openshift_master_etcd_use_ssl | default(None) }}"
  50. etcd_urls: "{{ openshift_master_etcd_urls | default(None) }}"
  51. embedded_etcd: "{{ openshift_master_embedded_etcd | default(None) }}"
  52. embedded_kube: "{{ openshift_master_embedded_kube | default(None) }}"
  53. embedded_dns: "{{ openshift_master_embedded_dns | default(None) }}"
  54. bind_addr: "{{ openshift_master_bind_addr | default(None) }}"
  55. pod_eviction_timeout: "{{ openshift_master_pod_eviction_timeout | default(None) }}"
  56. session_max_seconds: "{{ openshift_master_session_max_seconds | default(None) }}"
  57. session_name: "{{ openshift_master_session_name | default(None) }}"
  58. session_secrets_file: "{{ openshift_master_session_secrets_file | default(None) }}"
  59. session_auth_secrets: "{{ openshift_master_session_auth_secrets | default(None) }}"
  60. session_encryption_secrets: "{{ openshift_master_session_encryption_secrets | default(None) }}"
  61. access_token_max_seconds: "{{ openshift_master_access_token_max_seconds | default(None) }}"
  62. auth_token_max_seconds: "{{ openshift_master_auth_token_max_seconds | default(None) }}"
  63. identity_providers: "{{ openshift_master_identity_providers | default(None) }}"
  64. htpasswd_users: "{{ openshift_master_htpasswd_users | default(lookup('file', openshift_master_htpasswd_file) | oo_htpasswd_users_from_file if openshift_master_htpasswd_file is defined else None) }}"
  65. manage_htpasswd: "{{ openshift_master_manage_htpasswd | default(true) }}"
  66. ldap_ca: "{{ openshift_master_ldap_ca | default(lookup('file', openshift_master_ldap_ca_file) if openshift_master_ldap_ca_file is defined else None) }}"
  67. openid_ca: "{{ openshift_master_openid_ca | default(lookup('file', openshift_master_openid_ca_file) if openshift_master_openid_ca_file is defined else None) }}"
  68. request_header_ca: "{{ openshift_master_request_header_ca | default(lookup('file', openshift_master_request_header_ca_file) if openshift_master_request_header_ca_file is defined else None) }}"
  69. registry_url: "{{ oreg_url_master | default(oreg_url) | default(None) }}"
  70. oauth_grant_method: "{{ openshift_master_oauth_grant_method | default(None) }}"
  71. sdn_cluster_network_cidr: "{{ osm_cluster_network_cidr | default(None) }}"
  72. sdn_host_subnet_length: "{{ osm_host_subnet_length | default(None) }}"
  73. custom_cors_origins: "{{ osm_custom_cors_origins | default(None) }}"
  74. default_node_selector: "{{ osm_default_node_selector | default(None) }}"
  75. project_request_message: "{{ osm_project_request_message | default(None) }}"
  76. project_request_template: "{{ osm_project_request_template | default(None) }}"
  77. mcs_allocator_range: "{{ osm_mcs_allocator_range | default(None) }}"
  78. mcs_labels_per_project: "{{ osm_mcs_labels_per_project | default(None) }}"
  79. uid_allocator_range: "{{ osm_uid_allocator_range | default(None) }}"
  80. registry_selector: "{{ openshift_registry_selector | default(None) }}"
  81. api_server_args: "{{ osm_api_server_args | default(None) }}"
  82. controller_args: "{{ osm_controller_args | default(None) }}"
  83. disabled_features: "{{ osm_disabled_features | default(None) }}"
  84. master_count: "{{ openshift_master_count | default(None) }}"
  85. master_image: "{{ osm_image | default(None) }}"
  86. admission_plugin_config: "{{openshift_master_admission_plugin_config }}"
  87. kube_admission_plugin_config: "{{openshift_master_kube_admission_plugin_config | default(None) }}" # deprecated, merged with admission_plugin_config
  88. oauth_template: "{{ openshift_master_oauth_template | default(None) }}" # deprecated in origin 1.2 / OSE 3.2
  89. oauth_templates: "{{ openshift_master_oauth_templates | default(None) }}"
  90. oauth_always_show_provider_selection: "{{ openshift_master_oauth_always_show_provider_selection | default(None) }}"
  91. image_policy_config: "{{ openshift_master_image_policy_config | default(None) }}"
  92. dynamic_provisioning_enabled: "{{ openshift_master_dynamic_provisioning_enabled | default(None) }}"
  93. max_requests_inflight: "{{ openshift_master_max_requests_inflight | default(None) }}"
  94. api_env_vars: "{{ openshift_master_api_env_vars | default(None) }}"
  95. controllers_env_vars: "{{ openshift_master_controllers_env_vars | default(None) }}"
  96. audit_config: "{{ openshift_master_audit_config | default(None) }}"
  97. scheduler_args: "{{ openshift_master_scheduler_args | default(None) }}"
  98. - name: Determine if scheduler config present
  99. stat:
  100. path: "{{ openshift_master_scheduler_conf }}"
  101. register: scheduler_config_stat
  102. - name: Set Default scheduler predicates and priorities
  103. set_fact:
  104. openshift_master_scheduler_default_predicates: "{{ lookup('openshift_master_facts_default_predicates') }}"
  105. openshift_master_scheduler_default_priorities: "{{ lookup('openshift_master_facts_default_priorities') }}"
  106. - block:
  107. - name: Retrieve current scheduler config
  108. slurp:
  109. src: "{{ openshift_master_scheduler_conf }}"
  110. register: current_scheduler_config
  111. - name: Set openshift_master_scheduler_current_config
  112. set_fact:
  113. openshift_master_scheduler_current_config: "{{ current_scheduler_config.content | b64decode | from_json }}"
  114. - name: Test if scheduler config is readable
  115. fail:
  116. msg: "Unknown scheduler config apiVersion {{ openshift_master_scheduler_config.apiVersion }}"
  117. when: openshift_master_scheduler_current_config.apiVersion | default(None) != 'v1'
  118. - name: Set current scheduler predicates and priorities
  119. set_fact:
  120. openshift_master_scheduler_current_predicates: "{{ openshift_master_scheduler_current_config.predicates }}"
  121. openshift_master_scheduler_current_priorities: "{{ openshift_master_scheduler_current_config.priorities }}"
  122. when: scheduler_config_stat.stat.exists