main.yml 8.7 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. - fail:
  8. msg: openshift_master_default_subdomain must be set to deploy metrics
  9. when: openshift_hosted_metrics_deploy | default(false) | bool and openshift_master_default_subdomain | default("") == ""
  10. # NOTE: These metrics variables are unfortunately needed by both the master and the metrics roles
  11. # to properly configure the master-config.yaml file.
  12. #
  13. # NOTE: Today only changing the hostname for the metrics public URL is supported, the
  14. # path must stay consistent. As such if openshift_hosted_metrics_public_url is set in
  15. # inventory, we extract the hostname, and then reset openshift_hosted_metrics_public_url
  16. # to the format that we know is valid. (This may change in future)
  17. - set_fact:
  18. g_metrics_hostname: "{{ openshift_hosted_metrics_public_url
  19. | default('hawkular-metrics.' ~ (openshift_master_default_subdomain))
  20. | oo_hostname_from_url }}"
  21. when: openshift_hosted_metrics_deploy | default(false) | bool
  22. - set_fact:
  23. openshift_hosted_metrics_public_url: "https://{{ g_metrics_hostname }}/hawkular/metrics"
  24. when: openshift_hosted_metrics_deploy | default(false) | bool
  25. - name: Set master facts
  26. openshift_facts:
  27. role: master
  28. local_facts:
  29. cluster_method: "{{ openshift_master_cluster_method | default(None) }}"
  30. cluster_hostname: "{{ openshift_master_cluster_hostname | default(None) }}"
  31. cluster_public_hostname: "{{ openshift_master_cluster_public_hostname | default(None) }}"
  32. debug_level: "{{ openshift_master_debug_level | default(openshift.common.debug_level) }}"
  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. # defaults to 8053 when using dnsmasq in 1.2/3.2
  55. dns_port: "{{ openshift_master_dns_port | default(None) }}"
  56. bind_addr: "{{ openshift_master_bind_addr | default(None) }}"
  57. pod_eviction_timeout: "{{ openshift_master_pod_eviction_timeout | default(None) }}"
  58. session_max_seconds: "{{ openshift_master_session_max_seconds | default(None) }}"
  59. session_name: "{{ openshift_master_session_name | default(None) }}"
  60. session_secrets_file: "{{ openshift_master_session_secrets_file | default(None) }}"
  61. session_auth_secrets: "{{ openshift_master_session_auth_secrets | default(None) }}"
  62. session_encryption_secrets: "{{ openshift_master_session_encryption_secrets | default(None) }}"
  63. access_token_max_seconds: "{{ openshift_master_access_token_max_seconds | default(None) }}"
  64. auth_token_max_seconds: "{{ openshift_master_auth_token_max_seconds | default(None) }}"
  65. identity_providers: "{{ openshift_master_identity_providers | default(None) }}"
  66. 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) }}"
  67. manage_htpasswd: "{{ openshift_master_manage_htpasswd | default(true) }}"
  68. ldap_ca: "{{ openshift_master_ldap_ca | default(lookup('file', openshift_master_ldap_ca_file) if openshift_master_ldap_ca_file is defined else None) }}"
  69. openid_ca: "{{ openshift_master_openid_ca | default(lookup('file', openshift_master_openid_ca_file) if openshift_master_openid_ca_file is defined else None) }}"
  70. 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) }}"
  71. registry_url: "{{ oreg_url | default(None) }}"
  72. oauth_grant_method: "{{ openshift_master_oauth_grant_method | default(None) }}"
  73. sdn_cluster_network_cidr: "{{ osm_cluster_network_cidr | default(None) }}"
  74. sdn_host_subnet_length: "{{ osm_host_subnet_length | default(None) }}"
  75. custom_cors_origins: "{{ osm_custom_cors_origins | default(None) }}"
  76. default_node_selector: "{{ osm_default_node_selector | default(None) }}"
  77. project_request_message: "{{ osm_project_request_message | default(None) }}"
  78. project_request_template: "{{ osm_project_request_template | default(None) }}"
  79. mcs_allocator_range: "{{ osm_mcs_allocator_range | default(None) }}"
  80. mcs_labels_per_project: "{{ osm_mcs_labels_per_project | default(None) }}"
  81. uid_allocator_range: "{{ osm_uid_allocator_range | default(None) }}"
  82. registry_selector: "{{ openshift_registry_selector | default(None) }}"
  83. api_server_args: "{{ osm_api_server_args | default(None) }}"
  84. controller_args: "{{ osm_controller_args | default(None) }}"
  85. disabled_features: "{{ osm_disabled_features | default(None) }}"
  86. master_count: "{{ openshift_master_count | default(None) }}"
  87. controller_lease_ttl: "{{ osm_controller_lease_ttl | default(None) }}"
  88. master_image: "{{ osm_image | default(None) }}"
  89. admission_plugin_config: "{{openshift_master_admission_plugin_config | default(None) }}"
  90. kube_admission_plugin_config: "{{openshift_master_kube_admission_plugin_config | default(None) }}" # deprecated, merged with admission_plugin_config
  91. oauth_template: "{{ openshift_master_oauth_template | default(None) }}" # deprecated in origin 1.2 / OSE 3.2
  92. oauth_templates: "{{ openshift_master_oauth_templates | default(None) }}"
  93. oauth_always_show_provider_selection: "{{ openshift_master_oauth_always_show_provider_selection | default(None) }}"
  94. image_policy_config: "{{ openshift_master_image_policy_config | default(None) }}"
  95. dynamic_provisioning_enabled: "{{ openshift_master_dynamic_provisioning_enabled | default(None) }}"
  96. max_requests_inflight: "{{ openshift_master_max_requests_inflight | default(None) }}"
  97. api_env_vars: "{{ openshift_master_api_env_vars | default(None) }}"
  98. controllers_env_vars: "{{ openshift_master_controllers_env_vars | default(None) }}"
  99. audit_config: "{{ openshift_master_audit_config | default(None) }}"
  100. scheduler_args: "{{ openshift_master_scheduler_args | default(None) }}"
  101. - name: Determine if scheduler config present
  102. stat:
  103. path: "{{ openshift_master_scheduler_conf }}"
  104. register: scheduler_config_stat
  105. - set_fact:
  106. openshift_master_scheduler_default_predicates: "{{ lookup('openshift_master_facts_default_predicates') }}"
  107. openshift_master_scheduler_default_priorities: "{{ lookup('openshift_master_facts_default_priorities') }}"
  108. - block:
  109. - name: Retrieve current scheduler config
  110. slurp:
  111. src: "{{ openshift_master_scheduler_conf }}"
  112. register: current_scheduler_config
  113. - set_fact:
  114. openshift_master_scheduler_current_config: "{{ current_scheduler_config.content | b64decode | from_json }}"
  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. - set_fact:
  119. openshift_master_scheduler_current_predicates: "{{ openshift_master_scheduler_current_config.predicates }}"
  120. openshift_master_scheduler_current_priorities: "{{ openshift_master_scheduler_current_config.priorities }}"
  121. when: "{{ scheduler_config_stat.stat.exists }}"