facts.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 host facts
  7. # l_upgrade_non_node_hosts is passed in via play during control-plane-only
  8. # upgrades; otherwise oo_all_hosts is used.
  9. hosts: "{{ l_upgrade_non_node_hosts | default('oo_all_hosts') }}"
  10. tasks:
  11. - name: load openshift_facts module
  12. import_role:
  13. name: openshift_facts
  14. # TODO: Should this role be refactored into health_checks??
  15. - name: Run openshift_sanitize_inventory to set variables
  16. import_role:
  17. name: openshift_sanitize_inventory
  18. - name: Detecting Operating System from ostree_booted
  19. stat:
  20. path: /run/ostree-booted
  21. register: ostree_booted
  22. # TODO(michaelgugino) remove this line once CI is updated.
  23. - name: set openshift_deployment_type if unset
  24. set_fact:
  25. openshift_deployment_type: "{{ deployment_type }}"
  26. when:
  27. - openshift_deployment_type is undefined
  28. - deployment_type is defined
  29. - name: initialize_facts set fact openshift_is_atomic and openshift_is_containerized
  30. set_fact:
  31. openshift_is_atomic: "{{ ostree_booted.stat.exists }}"
  32. openshift_is_containerized: "{{ ostree_booted.stat.exists or (containerized | default(false) | bool) }}"
  33. # TODO: Should this be moved into health checks??
  34. # Seems as though any check that happens with a corresponding fail should move into health_checks
  35. # Fail as early as possible if Atomic and old version of Docker
  36. - when:
  37. - openshift_is_atomic | bool
  38. block:
  39. # See https://access.redhat.com/articles/2317361
  40. # and https://github.com/ansible/ansible/issues/15892
  41. # NOTE: the "'s can not be removed at this level else the docker command will fail
  42. # NOTE: When ansible >2.2.1.x is used this can be updated per
  43. # https://github.com/openshift/openshift-ansible/pull/3475#discussion_r103525121
  44. - name: Determine Atomic Host Docker Version
  45. shell: 'CURLY="{"; docker version --format "$CURLY{json .Server.Version}}"'
  46. register: l_atomic_docker_version
  47. - name: assert atomic host docker version is 1.12 or later
  48. assert:
  49. that:
  50. - l_atomic_docker_version.stdout | replace('"', '') is version_compare('1.12','>=')
  51. msg: Installation on Atomic Host requires Docker 1.12 or later. Please upgrade and restart the Atomic Host.
  52. - name: Gather Cluster facts
  53. openshift_facts:
  54. role: common
  55. local_facts:
  56. deployment_type: "{{ openshift_deployment_type }}"
  57. deployment_subtype: "{{ openshift_deployment_subtype | default(None) }}"
  58. hostname: "{{ openshift_hostname | default(None) }}"
  59. ip: "{{ openshift_ip | default(None) }}"
  60. public_hostname: "{{ openshift_public_hostname | default(None) }}"
  61. public_ip: "{{ openshift_public_ip | default(None) }}"
  62. portal_net: "{{ openshift_portal_net | default(openshift_master_portal_net) | default(None) }}"
  63. http_proxy: "{{ openshift_http_proxy | default(None) }}"
  64. https_proxy: "{{ openshift_https_proxy | default(None) }}"
  65. no_proxy: "{{ openshift_no_proxy | default(None) }}"
  66. generate_no_proxy_hosts: "{{ openshift_generate_no_proxy_hosts | default(True) }}"
  67. - name: Set fact of no_proxy_internal_hostnames
  68. openshift_facts:
  69. role: common
  70. local_facts:
  71. no_proxy_internal_hostnames: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_nodes_to_config']
  72. | union(groups['oo_masters_to_config'])
  73. | union(groups['oo_etcd_to_config'] | default([])))
  74. | lib_utils_oo_collect('openshift.common.hostname') | default([]) | join (',')
  75. }}"
  76. when:
  77. - openshift_http_proxy is defined or openshift_https_proxy is defined
  78. - openshift_generate_no_proxy_hosts | default(True) | bool
  79. - name: Initialize openshift.node.sdn_mtu
  80. openshift_facts:
  81. role: node
  82. local_facts:
  83. sdn_mtu: "{{ openshift_node_sdn_mtu | default(None) }}"
  84. - name: Initialize special first-master variables
  85. hosts: oo_first_master
  86. roles:
  87. - role: openshift_facts
  88. tasks:
  89. - set_fact:
  90. # We need to setup openshift_client_binary here for special uses of delegate_to in
  91. # later roles and plays.
  92. first_master_client_binary: "{{ openshift_client_binary }}"
  93. #Some roles may require this to be set for first master
  94. openshift_client_binary: "{{ openshift_client_binary }}"