main.yml 7.7 KB

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