123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- ---
- - name: Verify required variables are set
- fail:
- msg: openshift_master_default_subdomain must be set to deploy metrics
- when: openshift_hosted_metrics_deploy | default(false) | bool and openshift_master_default_subdomain == ""
- # NOTE: These metrics variables are unfortunately needed by both the master and the metrics roles
- # to properly configure the master-config.yaml file.
- #
- # NOTE: Today only changing the hostname for the metrics public URL is supported, the
- # path must stay consistent. As such if openshift_hosted_metrics_public_url is set in
- # inventory, we extract the hostname, and then reset openshift_hosted_metrics_public_url
- # to the format that we know is valid. (This may change in future)
- - name: Set g_metrics_hostname
- set_fact:
- g_metrics_hostname: "{{ openshift_hosted_metrics_public_url
- | default('hawkular-metrics.' ~ openshift_master_default_subdomain)
- | lib_utils_oo_hostname_from_url }}"
- - set_fact:
- openshift_hosted_metrics_deploy_url: "https://{{ g_metrics_hostname }}/hawkular/metrics"
- when: (openshift_hosted_metrics_deploy | default(false) | bool) or (openshift_hosted_metrics_public_url is defined)
- - name: Set master facts
- openshift_facts:
- role: master
- local_facts:
- cluster_hostname: "{{ openshift_master_cluster_hostname | default(None) }}"
- cluster_public_hostname: "{{ openshift_master_cluster_public_hostname | default(None) }}"
- api_port: "{{ openshift_master_api_port | default(None) }}"
- api_url: "{{ openshift_master_api_url | default(None) }}"
- api_use_ssl: "{{ openshift_master_api_use_ssl | default(None) }}"
- public_api_url: "{{ openshift_master_public_api_url | default(None) }}"
- console_path: "{{ openshift_master_console_path | default(None) }}"
- console_port: "{{ openshift_master_console_port | default(None) }}"
- console_url: "{{ openshift_master_console_url | default(None) }}"
- console_use_ssl: "{{ openshift_master_console_use_ssl | default(None) }}"
- public_console_url: "{{ openshift_master_public_console_url | default(None) }}"
- logging_public_url: "{{ openshift_master_logging_public_url | default(None) }}"
- logout_url: "{{ openshift_master_logout_url | default(None) }}"
- extension_scripts: "{{ openshift_master_extension_scripts | default(None) }}"
- extension_stylesheets: "{{ openshift_master_extension_stylesheets | default(None) }}"
- extensions: "{{ openshift_master_extensions | default(None) }}"
- embedded_kube: "{{ openshift_master_embedded_kube | default(None) }}"
- embedded_dns: "{{ openshift_master_embedded_dns | default(None) }}"
- bind_addr: "{{ openshift_master_bind_addr | default(None) }}"
- pod_eviction_timeout: "{{ openshift_master_pod_eviction_timeout | default(None) }}"
- session_max_seconds: "{{ openshift_master_session_max_seconds | default(None) }}"
- session_name: "{{ openshift_master_session_name | default(None) }}"
- session_secrets_file: "{{ openshift_master_session_secrets_file | default(None) }}"
- session_auth_secrets: "{{ openshift_master_session_auth_secrets | default(None) }}"
- session_encryption_secrets: "{{ openshift_master_session_encryption_secrets | default(None) }}"
- access_token_max_seconds: "{{ openshift_master_access_token_max_seconds | default(None) }}"
- auth_token_max_seconds: "{{ openshift_master_auth_token_max_seconds | default(None) }}"
- # oo_htpasswd_users_from_file is a custom filter in role lib_utils
- 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) }}"
- manage_htpasswd: "{{ openshift_master_manage_htpasswd | default(true) }}"
- ldap_ca: "{{ openshift_master_ldap_ca | default(lookup('file', openshift_master_ldap_ca_file) if openshift_master_ldap_ca_file is defined else None) }}"
- openid_ca: "{{ openshift_master_openid_ca | default(lookup('file', openshift_master_openid_ca_file) if openshift_master_openid_ca_file is defined else None) }}"
- 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) }}"
- registry_url: "{{ oreg_url_master | default(oreg_url) | default(None) }}"
- oauth_grant_method: "{{ openshift_master_oauth_grant_method | default(None) }}"
- sdn_cluster_network_cidr: "{{ osm_cluster_network_cidr | default(None) }}"
- sdn_host_subnet_length: "{{ osm_host_subnet_length | default(None) }}"
- custom_cors_origins: "{{ osm_custom_cors_origins | default(None) }}"
- registry_selector: "{{ openshift_registry_selector | default(None) }}"
- api_server_args: "{{ osm_api_server_args | default(None) }}"
- controller_args: "{{ osm_controller_args | default(None) }}"
- disabled_features: "{{ osm_disabled_features | default(None) }}"
- master_count: "{{ openshift_master_count | default(None) }}"
- admission_plugin_config: "{{openshift_master_admission_plugin_config }}"
- kube_admission_plugin_config: "{{openshift_master_kube_admission_plugin_config | default(None) }}" # deprecated, merged with admission_plugin_config
- oauth_always_show_provider_selection: "{{ openshift_master_oauth_always_show_provider_selection | default(None) }}"
- image_policy_config: "{{ openshift_master_image_policy_config | default(None) }}"
- dynamic_provisioning_enabled: "{{ openshift_master_dynamic_provisioning_enabled | default(None) }}"
- max_requests_inflight: "{{ openshift_master_max_requests_inflight | default(None) }}"
- api_env_vars: "{{ openshift_master_api_env_vars | default(None) }}"
- controllers_env_vars: "{{ openshift_master_controllers_env_vars | default(None) }}"
- audit_config: "{{ openshift_master_audit_config | default(None) }}"
- scheduler_args: "{{ openshift_master_scheduler_args | default(None) }}"
- - name: Determine if scheduler config present
- stat:
- path: "{{ openshift_master_scheduler_conf }}"
- register: scheduler_config_stat
- - name: Set Default scheduler predicates and priorities
- set_fact:
- # openshift_master_facts_default_predicates is a custom lookup plugin in
- # role lib_utils
- openshift_master_scheduler_default_predicates: "{{ lookup('openshift_master_facts_default_predicates') }}"
- openshift_master_scheduler_default_priorities: "{{ lookup('openshift_master_facts_default_priorities') }}"
- - block:
- - name: Retrieve current scheduler config
- slurp:
- src: "{{ openshift_master_scheduler_conf }}"
- register: current_scheduler_config
- - name: Set openshift_master_scheduler_current_config
- set_fact:
- openshift_master_scheduler_current_config: "{{ current_scheduler_config.content | b64decode | from_json }}"
- - name: Test if scheduler config is readable
- fail:
- msg: "Unknown scheduler config apiVersion {{ openshift_master_scheduler_config.apiVersion }}"
- when: openshift_master_scheduler_current_config.apiVersion | default(None) != 'v1'
- - name: Set current scheduler predicates and priorities
- set_fact:
- openshift_master_scheduler_current_predicates: "{{ openshift_master_scheduler_current_config.predicates }}"
- openshift_master_scheduler_current_priorities: "{{ openshift_master_scheduler_current_config.priorities }}"
- when: scheduler_config_stat.stat.exists
|