main.yml 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ---
  2. - name: Detecting Operating System
  3. stat:
  4. path: /run/ostree-booted
  5. register: ostree_booted
  6. # Locally setup containerized facts for now
  7. - set_fact:
  8. l_is_atomic: "{{ ostree_booted.stat.exists }}"
  9. - set_fact:
  10. l_is_containerized: "{{ (l_is_atomic | bool) or (containerized | default(false) | bool) }}"
  11. l_is_openvswitch_system_container: "{{ (use_openvswitch_system_container | default(use_system_containers) | bool) }}"
  12. l_is_node_system_container: "{{ (use_node_system_container | default(use_system_containers) | bool) }}"
  13. l_is_master_system_container: "{{ (use_master_system_container | default(use_system_containers) | bool) }}"
  14. l_is_etcd_system_container: "{{ (use_etcd_system_container | default(use_system_containers) | bool) }}"
  15. - name: Validate python version
  16. fail:
  17. msg: |
  18. openshift-ansible requires Python 3 for {{ ansible_distribution }};
  19. For information on enabling Python 3 with Ansible, see https://docs.ansible.com/ansible/python_3_support.html
  20. when: ansible_distribution == 'Fedora' and ansible_python['version']['major'] != 3
  21. - name: Validate python version
  22. fail:
  23. msg: "openshift-ansible requires Python 2 for {{ ansible_distribution }}"
  24. when: ansible_distribution != 'Fedora' and ansible_python['version']['major'] != 2
  25. # Fail as early as possible if Atomic and old version of Docker
  26. - block:
  27. # See https://access.redhat.com/articles/2317361
  28. # and https://github.com/ansible/ansible/issues/15892
  29. # NOTE: the "'s can not be removed at this level else the docker command will fail
  30. # NOTE: When ansible >2.2.1.x is used this can be updated per
  31. # https://github.com/openshift/openshift-ansible/pull/3475#discussion_r103525121
  32. - name: Determine Atomic Host Docker Version
  33. shell: 'CURLY="{"; docker version --format "$CURLY{json .Server.Version}}"'
  34. register: l_atomic_docker_version
  35. - assert:
  36. msg: Installation on Atomic Host requires Docker 1.12 or later. Please upgrade and restart the Atomic Host.
  37. that:
  38. - l_atomic_docker_version.stdout | replace('"', '') | version_compare('1.12','>=')
  39. when: l_is_atomic | bool
  40. - name: Ensure various deps are installed
  41. package: name={{ item }} state=present
  42. with_items: "{{ required_packages }}"
  43. when: not l_is_atomic | bool
  44. - name: Gather Cluster facts and set is_containerized if needed
  45. openshift_facts:
  46. role: common
  47. local_facts:
  48. debug_level: "{{ openshift_debug_level | default(2) }}"
  49. # TODO: Deprecate deployment_type in favor of openshift_deployment_type
  50. deployment_type: "{{ openshift_deployment_type | default(deployment_type) }}"
  51. deployment_subtype: "{{ openshift_deployment_subtype | default(None) }}"
  52. cluster_id: "{{ openshift_cluster_id | default('default') }}"
  53. hostname: "{{ openshift_hostname | default(None) }}"
  54. ip: "{{ openshift_ip | default(None) }}"
  55. is_containerized: "{{ l_is_containerized | default(None) }}"
  56. is_openvswitch_system_container: "{{ l_is_openvswitch_system_container | default(false) }}"
  57. is_node_system_container: "{{ l_is_node_system_container | default(false) }}"
  58. is_master_system_container: "{{ l_is_master_system_container | default(false) }}"
  59. is_etcd_system_container: "{{ l_is_etcd_system_container | default(false) }}"
  60. system_images_registry: "{{ system_images_registry | default('') }}"
  61. public_hostname: "{{ openshift_public_hostname | default(None) }}"
  62. public_ip: "{{ openshift_public_ip | default(None) }}"
  63. portal_net: "{{ openshift_portal_net | default(openshift_master_portal_net) | default(None) }}"
  64. http_proxy: "{{ openshift_http_proxy | default(None) }}"
  65. https_proxy: "{{ openshift_https_proxy | default(None) }}"
  66. no_proxy: "{{ openshift_no_proxy | default(None) }}"
  67. generate_no_proxy_hosts: "{{ openshift_generate_no_proxy_hosts | default(True) }}"
  68. no_proxy_internal_hostnames: "{{ openshift_no_proxy_internal_hostnames | default(None) }}"
  69. sdn_network_plugin_name: "{{ os_sdn_network_plugin_name | default(None) }}"
  70. use_openshift_sdn: "{{ openshift_use_openshift_sdn | default(None) }}"
  71. - name: Set repoquery command
  72. set_fact:
  73. repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery --plugins' }}"