basic_facts.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ---
  2. - name: Ensure that all non-node hosts are accessible
  3. hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config:oo_nfs_to_config
  4. any_errors_fatal: true
  5. tasks:
  6. - name: Initialize basic host facts
  7. # l_init_fact_hosts is passed in via play during control-plane-only
  8. # upgrades and scale-up plays; otherwise oo_all_hosts is used.
  9. hosts: "{{ l_init_fact_hosts | default('oo_all_hosts') }}"
  10. roles:
  11. - role: openshift_facts
  12. tasks:
  13. # TODO: Should this role be refactored into health_checks??
  14. - name: Run openshift_sanitize_inventory to set variables
  15. import_role:
  16. name: openshift_sanitize_inventory
  17. - name: Detecting Operating System from ostree_booted
  18. stat:
  19. path: /run/ostree-booted
  20. register: ostree_booted
  21. # TODO(michaelgugino) remove this line once CI is updated.
  22. - name: set openshift_deployment_type if unset
  23. set_fact:
  24. openshift_deployment_type: "{{ deployment_type }}"
  25. when:
  26. - openshift_deployment_type is undefined
  27. - deployment_type is defined
  28. - name: check for node already bootstrapped
  29. stat:
  30. path: "/etc/origin/node/bootstrap-node-config.yaml"
  31. register: bootstrap_node_config_path_check
  32. - name: initialize_facts set fact openshift_is_bootstrapped
  33. set_fact:
  34. openshift_is_bootstrapped: "{{ openshift_is_bootstrapped|default(False) or bootstrap_node_config_path_check.stat.exists }}"
  35. - name: initialize_facts set fact openshift_is_atomic and openshift_is_containerized
  36. set_fact:
  37. openshift_is_atomic: "{{ ostree_booted.stat.exists }}"
  38. openshift_is_containerized: "{{ ostree_booted.stat.exists or (containerized | default(false) | bool) }}"
  39. - name: Set use_crio to True if cri-o rpm is requested
  40. set_fact:
  41. openshift_use_crio: True
  42. when:
  43. - openshift_crio_use_rpm | default(False) | bool
  44. # TODO: Should this be moved into health checks??
  45. # Seems as though any check that happens with a corresponding fail should move into health_checks
  46. # Fail as early as possible if Atomic and old version of Docker
  47. - when:
  48. - openshift_is_atomic | bool
  49. block:
  50. # See https://access.redhat.com/articles/2317361
  51. # and https://github.com/ansible/ansible/issues/15892
  52. # NOTE: the "'s can not be removed at this level else the docker command will fail
  53. # NOTE: When ansible >2.2.1.x is used this can be updated per
  54. # https://github.com/openshift/openshift-ansible/pull/3475#discussion_r103525121
  55. - name: Determine Atomic Host Docker Version
  56. shell: 'CURLY="{"; docker version --format "$CURLY{json .Server.Version}}"'
  57. register: l_atomic_docker_version
  58. - name: assert atomic host docker version is 1.12 or later
  59. assert:
  60. that:
  61. - l_atomic_docker_version.stdout | replace('"', '') is version_compare('1.12','>=')
  62. msg: Installation on Atomic Host requires Docker 1.12 or later. Please upgrade and restart the Atomic Host.
  63. - name: Retrieve existing master configs and validate
  64. hosts: oo_masters_to_config
  65. gather_facts: no
  66. any_errors_fatal: true
  67. roles:
  68. - openshift_facts
  69. tasks:
  70. - import_role:
  71. name: openshift_control_plane
  72. tasks_from: check_existing_config.yml
  73. - when:
  74. - l_existing_config_master_config is defined
  75. - l_existing_config_master_config.networkConfig is defined
  76. block:
  77. - set_fact:
  78. openshift_portal_net: "{{ l_existing_config_master_config.networkConfig.serviceNetworkCIDR }}"
  79. - set_fact:
  80. osm_cluster_network_cidr: "{{ l_existing_config_master_config.networkConfig.clusterNetworks[0].cidr }}"
  81. osm_host_subnet_length: "{{ l_existing_config_master_config.networkConfig.clusterNetworks[0].hostSubnetLength }}"
  82. when:
  83. - l_existing_config_master_config.networkConfig.clusterNetworks is defined
  84. # Use deprecated config variables if newer ones not found above.
  85. - set_fact:
  86. osm_cluster_network_cidr: "{{ l_existing_config_master_config.networkConfig.clusterNetworkCIDR }}"
  87. osm_host_subnet_length: "{{ l_existing_config_master_config.networkConfig.hostSubnetLength }}"
  88. when:
  89. - l_existing_config_master_config.networkConfig.clusterNetworks is not defined
  90. # End block
  91. - name: Initialize special first-master variables
  92. hosts: oo_first_master
  93. roles:
  94. - role: openshift_facts
  95. tasks:
  96. - when: not (osm_default_node_selector is defined)
  97. block:
  98. - set_fact:
  99. # l_existing_config_master_config is set in openshift_control_plane/tasks/check_existing_config.yml
  100. openshift_master_config_node_selector: "{{ l_existing_config_master_config.projectConfig.defaultNodeSelector }}"
  101. when:
  102. - l_existing_config_master_config is defined
  103. - l_existing_config_master_config.projectConfig is defined
  104. - l_existing_config_master_config.projectConfig.defaultNodeSelector is defined
  105. - l_existing_config_master_config.projectConfig.defaultNodeSelector != ''
  106. - set_fact:
  107. # We need to setup openshift_client_binary here for special uses of delegate_to in
  108. # later roles and plays.
  109. first_master_client_binary: "{{ openshift_client_binary }}"
  110. #Some roles may require this to be set for first master
  111. openshift_client_binary: "{{ openshift_client_binary }}"
  112. # we need to know if a default node selector has been manually set outside the installer
  113. l_osm_default_node_selector: '{{ osm_default_node_selector | default(openshift_master_config_node_selector) | default("node-role.kubernetes.io/compute=true") }}'
  114. - name: Disable web console if required
  115. hosts: oo_masters_to_config
  116. gather_facts: no
  117. tasks:
  118. - set_fact:
  119. openshift_web_console_install: False
  120. when:
  121. - openshift_deployment_subtype is defined
  122. - openshift_deployment_subtype == 'registry' or ( osm_disabled_features is defined and 'WebConsole' in osm_disabled_features )