facts.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. hosts: oo_all_hosts
  8. tasks:
  9. - name: load openshift_facts module
  10. import_role:
  11. name: openshift_facts
  12. # TODO: Should this role be refactored into health_checks??
  13. - name: Run openshift_sanitize_inventory to set variables
  14. include_role:
  15. name: openshift_sanitize_inventory
  16. - name: Detecting Operating System from ostree_booted
  17. stat:
  18. path: /run/ostree-booted
  19. register: ostree_booted
  20. - name: initialize_facts set fact openshift_is_atomic and openshift_is_containerized
  21. set_fact:
  22. openshift_is_atomic: "{{ ostree_booted.stat.exists }}"
  23. openshift_is_containerized: "{{ ostree_booted.stat.exists or (containerized | default(false) | bool) }}"
  24. # TODO: Should this be moved into health checks??
  25. # Seems as though any check that happens with a corresponding fail should move into health_checks
  26. # Fail as early as possible if Atomic and old version of Docker
  27. - when:
  28. - openshift_is_atomic | bool
  29. block:
  30. # See https://access.redhat.com/articles/2317361
  31. # and https://github.com/ansible/ansible/issues/15892
  32. # NOTE: the "'s can not be removed at this level else the docker command will fail
  33. # NOTE: When ansible >2.2.1.x is used this can be updated per
  34. # https://github.com/openshift/openshift-ansible/pull/3475#discussion_r103525121
  35. - name: Determine Atomic Host Docker Version
  36. shell: 'CURLY="{"; docker version --format "$CURLY{json .Server.Version}}"'
  37. register: l_atomic_docker_version
  38. - name: assert atomic host docker version is 1.12 or later
  39. assert:
  40. that:
  41. - l_atomic_docker_version.stdout | replace('"', '') is version_compare('1.12','>=')
  42. msg: Installation on Atomic Host requires Docker 1.12 or later. Please upgrade and restart the Atomic Host.
  43. - when:
  44. - not openshift_is_atomic | bool
  45. block:
  46. - name: Ensure openshift-ansible installer package deps are installed
  47. package:
  48. name: "{{ item }}"
  49. state: present
  50. with_items:
  51. - iproute
  52. - "{{ 'python3-dbus' if ansible_distribution == 'Fedora' else 'dbus-python' }}"
  53. - "{{ 'python3-PyYAML' if ansible_distribution == 'Fedora' else 'PyYAML' }}"
  54. - yum-utils
  55. register: result
  56. until: result is succeeded
  57. - name: Ensure various deps for running system containers are installed
  58. package:
  59. name: "{{ item }}"
  60. state: present
  61. with_items:
  62. - atomic
  63. - ostree
  64. - runc
  65. when:
  66. - >
  67. (openshift_use_system_containers | default(False)) | bool
  68. or (openshift_use_etcd_system_container | default(False)) | bool
  69. or (openshift_use_openvswitch_system_container | default(False)) | bool
  70. or (openshift_use_node_system_container | default(False)) | bool
  71. or (openshift_use_master_system_container | default(False)) | bool
  72. register: result
  73. until: result is succeeded
  74. - name: Gather Cluster facts
  75. openshift_facts:
  76. role: common
  77. local_facts:
  78. deployment_type: "{{ openshift_deployment_type }}"
  79. deployment_subtype: "{{ openshift_deployment_subtype | default(None) }}"
  80. hostname: "{{ openshift_hostname | default(None) }}"
  81. ip: "{{ openshift_ip | default(None) }}"
  82. public_hostname: "{{ openshift_public_hostname | default(None) }}"
  83. public_ip: "{{ openshift_public_ip | default(None) }}"
  84. portal_net: "{{ openshift_portal_net | default(openshift_master_portal_net) | default(None) }}"
  85. http_proxy: "{{ openshift_http_proxy | default(None) }}"
  86. https_proxy: "{{ openshift_https_proxy | default(None) }}"
  87. no_proxy: "{{ openshift_no_proxy | default(None) }}"
  88. generate_no_proxy_hosts: "{{ openshift_generate_no_proxy_hosts | default(True) }}"
  89. - name: Set fact of no_proxy_internal_hostnames
  90. openshift_facts:
  91. role: common
  92. local_facts:
  93. no_proxy_internal_hostnames: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_nodes_to_config']
  94. | union(groups['oo_masters_to_config'])
  95. | union(groups['oo_etcd_to_config'] | default([])))
  96. | lib_utils_oo_collect('openshift.common.hostname') | default([]) | join (',')
  97. }}"
  98. when:
  99. - openshift_http_proxy is defined or openshift_https_proxy is defined
  100. - openshift_generate_no_proxy_hosts | default(True) | bool
  101. - name: Initialize openshift.node.sdn_mtu
  102. openshift_facts:
  103. role: node
  104. local_facts:
  105. sdn_mtu: "{{ openshift_node_sdn_mtu | default(None) }}"
  106. - name: Initialize special first-master variables
  107. hosts: oo_first_master
  108. roles:
  109. - role: openshift_facts
  110. tasks:
  111. - set_fact:
  112. # We need to setup openshift_client_binary here for special uses of delegate_to in
  113. # later roles and plays.
  114. first_master_client_binary: "{{ openshift_client_binary }}"