main.yml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. debug_level: "{{ openshift_master_debug_level | default(openshift.common.debug_level) }}"
  34. api_port: "{{ openshift_master_api_port | default(None) }}"
  35. api_url: "{{ openshift_master_api_url | default(None) }}"
  36. api_use_ssl: "{{ openshift_master_api_use_ssl | default(None) }}"
  37. public_api_url: "{{ openshift_master_public_api_url | default(None) }}"
  38. console_path: "{{ openshift_master_console_path | default(None) }}"
  39. console_port: "{{ openshift_master_console_port | default(None) }}"
  40. console_url: "{{ openshift_master_console_url | default(None) }}"
  41. console_use_ssl: "{{ openshift_master_console_use_ssl | default(None) }}"
  42. public_console_url: "{{ openshift_master_public_console_url | default(None) }}"
  43. logging_public_url: "{{ openshift_master_logging_public_url | default(None) }}"
  44. logout_url: "{{ openshift_master_logout_url | default(None) }}"
  45. extension_scripts: "{{ openshift_master_extension_scripts | default(None) }}"
  46. extension_stylesheets: "{{ openshift_master_extension_stylesheets | default(None) }}"
  47. extensions: "{{ openshift_master_extensions | default(None) }}"
  48. etcd_hosts: "{{ openshift_master_etcd_hosts | default(None) }}"
  49. etcd_port: "{{ openshift_master_etcd_port | default(None) }}"
  50. etcd_use_ssl: "{{ openshift_master_etcd_use_ssl | default(None) }}"
  51. etcd_urls: "{{ openshift_master_etcd_urls | default(None) }}"
  52. embedded_etcd: "{{ openshift_master_embedded_etcd | default(None) }}"
  53. embedded_kube: "{{ openshift_master_embedded_kube | default(None) }}"
  54. embedded_dns: "{{ openshift_master_embedded_dns | default(None) }}"
  55. # defaults to 8053 when using dnsmasq in 1.2/3.2
  56. dns_port: "{{ openshift_master_dns_port | default(None) }}"
  57. bind_addr: "{{ openshift_master_bind_addr | default(None) }}"
  58. pod_eviction_timeout: "{{ openshift_master_pod_eviction_timeout | default(None) }}"
  59. session_max_seconds: "{{ openshift_master_session_max_seconds | default(None) }}"
  60. session_name: "{{ openshift_master_session_name | default(None) }}"
  61. session_secrets_file: "{{ openshift_master_session_secrets_file | default(None) }}"
  62. session_auth_secrets: "{{ openshift_master_session_auth_secrets | default(None) }}"
  63. session_encryption_secrets: "{{ openshift_master_session_encryption_secrets | default(None) }}"
  64. access_token_max_seconds: "{{ openshift_master_access_token_max_seconds | default(None) }}"
  65. auth_token_max_seconds: "{{ openshift_master_auth_token_max_seconds | default(None) }}"
  66. identity_providers: "{{ openshift_master_identity_providers | default(None) }}"
  67. 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) }}"
  68. manage_htpasswd: "{{ openshift_master_manage_htpasswd | default(true) }}"
  69. ldap_ca: "{{ openshift_master_ldap_ca | default(lookup('file', openshift_master_ldap_ca_file) if openshift_master_ldap_ca_file is defined else None) }}"
  70. openid_ca: "{{ openshift_master_openid_ca | default(lookup('file', openshift_master_openid_ca_file) if openshift_master_openid_ca_file is defined else None) }}"
  71. 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) }}"
  72. registry_url: "{{ oreg_url_master | default(oreg_url) | default(None) }}"
  73. oauth_grant_method: "{{ openshift_master_oauth_grant_method | default(None) }}"
  74. sdn_cluster_network_cidr: "{{ osm_cluster_network_cidr | default(None) }}"
  75. sdn_host_subnet_length: "{{ osm_host_subnet_length | default(None) }}"
  76. custom_cors_origins: "{{ osm_custom_cors_origins | default(None) }}"
  77. default_node_selector: "{{ osm_default_node_selector | default(None) }}"
  78. project_request_message: "{{ osm_project_request_message | default(None) }}"
  79. project_request_template: "{{ osm_project_request_template | default(None) }}"
  80. mcs_allocator_range: "{{ osm_mcs_allocator_range | default(None) }}"
  81. mcs_labels_per_project: "{{ osm_mcs_labels_per_project | default(None) }}"
  82. uid_allocator_range: "{{ osm_uid_allocator_range | default(None) }}"
  83. registry_selector: "{{ openshift_registry_selector | default(None) }}"
  84. api_server_args: "{{ osm_api_server_args | default(None) }}"
  85. controller_args: "{{ osm_controller_args | default(None) }}"
  86. disabled_features: "{{ osm_disabled_features | default(None) }}"
  87. master_count: "{{ openshift_master_count | default(None) }}"
  88. controller_lease_ttl: "{{ osm_controller_lease_ttl | default(None) }}"
  89. master_image: "{{ osm_image | default(None) }}"
  90. admission_plugin_config: "{{openshift_master_admission_plugin_config }}"
  91. kube_admission_plugin_config: "{{openshift_master_kube_admission_plugin_config | default(None) }}" # deprecated, merged with admission_plugin_config
  92. oauth_template: "{{ openshift_master_oauth_template | default(None) }}" # deprecated in origin 1.2 / OSE 3.2
  93. oauth_templates: "{{ openshift_master_oauth_templates | default(None) }}"
  94. oauth_always_show_provider_selection: "{{ openshift_master_oauth_always_show_provider_selection | default(None) }}"
  95. image_policy_config: "{{ openshift_master_image_policy_config | default(None) }}"
  96. dynamic_provisioning_enabled: "{{ openshift_master_dynamic_provisioning_enabled | default(None) }}"
  97. max_requests_inflight: "{{ openshift_master_max_requests_inflight | default(None) }}"
  98. api_env_vars: "{{ openshift_master_api_env_vars | default(None) }}"
  99. controllers_env_vars: "{{ openshift_master_controllers_env_vars | default(None) }}"
  100. audit_config: "{{ openshift_master_audit_config | default(None) }}"
  101. scheduler_args: "{{ openshift_master_scheduler_args | default(None) }}"
  102. - name: Determine if scheduler config present
  103. stat:
  104. path: "{{ openshift_master_scheduler_conf }}"
  105. register: scheduler_config_stat
  106. - name: Set Default scheduler predicates and priorities
  107. set_fact:
  108. openshift_master_scheduler_default_predicates: "{{ lookup('openshift_master_facts_default_predicates') }}"
  109. openshift_master_scheduler_default_priorities: "{{ lookup('openshift_master_facts_default_priorities') }}"
  110. - block:
  111. - name: Retrieve current scheduler config
  112. slurp:
  113. src: "{{ openshift_master_scheduler_conf }}"
  114. register: current_scheduler_config
  115. - name: Set openshift_master_scheduler_current_config
  116. set_fact:
  117. openshift_master_scheduler_current_config: "{{ current_scheduler_config.content | b64decode | from_json }}"
  118. - name: Test if scheduler config is readable
  119. fail:
  120. msg: "Unknown scheduler config apiVersion {{ openshift_master_scheduler_config.apiVersion }}"
  121. when: openshift_master_scheduler_current_config.apiVersion | default(None) != 'v1'
  122. - name: Set current scheduler predicates and priorities
  123. set_fact:
  124. openshift_master_scheduler_current_predicates: "{{ openshift_master_scheduler_current_config.predicates }}"
  125. openshift_master_scheduler_current_priorities: "{{ openshift_master_scheduler_current_config.priorities }}"
  126. when: scheduler_config_stat.stat.exists