main.yml 7.9 KB

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