main.yml 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ---
  2. - name: Set docker facts
  3. openshift_facts:
  4. role: "{{ item.role }}"
  5. local_facts: "{{ item.local_facts }}"
  6. with_items:
  7. - role: docker
  8. local_facts:
  9. additional_registries: "{{ openshift_docker_additional_registries | default(None) }}"
  10. blocked_registries: "{{ openshift_docker_blocked_registries | default(None) }}"
  11. insecure_registries: "{{ openshift_docker_insecure_registries | default(None) }}"
  12. log_driver: "{{ openshift_docker_log_driver | default(None) }}"
  13. log_options: "{{ openshift_docker_log_options | default(None) }}"
  14. options: "{{ openshift_docker_options | default(None) }}"
  15. disable_push_dockerhub: "{{ openshift_disable_push_dockerhub | default(None) }}"
  16. hosted_registry_insecure: "{{ openshift_docker_hosted_registry_insecure | default(None) }}"
  17. hosted_registry_network: "{{ openshift_docker_hosted_registry_network | default(None) }}"
  18. - set_fact:
  19. docker_additional_registries: "{{ openshift.docker.additional_registries
  20. | default(omit) }}"
  21. docker_blocked_registries: "{{ openshift.docker.blocked_registries
  22. | default(omit) }}"
  23. docker_insecure_registries: "{{ openshift.docker.insecure_registries
  24. | default(omit) }}"
  25. docker_log_driver: "{{ openshift.docker.log_driver | default(omit) }}"
  26. docker_log_options: "{{ openshift.docker.log_options | default(omit) }}"
  27. docker_push_dockerhub: "{{ openshift.docker.disable_push_dockerhub
  28. | default(omit) }}"
  29. docker_http_proxy: "{{ openshift.common.http_proxy | default(omit) }}"
  30. docker_https_proxy: "{{ openshift.common.https_proxy | default(omit) }}"
  31. docker_no_proxy: "{{ openshift.common.no_proxy | default(omit) }}"
  32. - set_fact:
  33. docker_options: "--insecure-registry={{ openshift.docker.hosted_registry_network }} {{ openshift.docker.options | default ('') }}"
  34. when: openshift.docker.hosted_registry_insecure | default(False) | bool and openshift.docker.hosted_registry_network is defined
  35. - set_fact:
  36. docker_options: "{{ openshift.docker.options | default(omit) }}"
  37. when: not openshift.docker.hosted_registry_insecure | default(False) | bool
  38. # Avoid docker 1.9 when installing origin < 1.2 or OSE < 3.2 on RHEL/Centos and
  39. # See: https://bugzilla.redhat.com/show_bug.cgi?id=1304038
  40. - name: Gather common package version
  41. command: >
  42. {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type}}"
  43. register: common_version
  44. failed_when: false
  45. changed_when: false
  46. when: not openshift.common.is_containerized | bool
  47. - set_fact:
  48. l_common_version: "{{ openshift_version | default('0.0', True) | oo_image_tag_to_rpm_version }}"
  49. when: openshift.common.is_containerized | bool
  50. - set_fact:
  51. l_common_version: "{{ common_version.stdout | default('0.0', True) }}"
  52. when: not openshift.common.is_containerized | bool
  53. - debug: var=l_common_version
  54. - name: Set docker version to be installed
  55. set_fact:
  56. docker_version: "{{ '1.8.2' }}"
  57. when: " ( l_common_version | version_compare('3.2','<') and openshift.common.service_type in ['openshift', 'atomic-openshift'] ) or
  58. ( l_common_version | version_compare('1.1.4','<') and openshift.common.service_type == 'origin' )"
  59. - name: Set docker version to be installed
  60. set_fact:
  61. docker_version: "{{ '1.9.1' }}"
  62. when: " ( l_common_version | version_compare('3.2','>') and openshift.common.service_type == 'atomic-openshift' ) or
  63. ( l_common_version | version_compare('1.2','>') and openshift.common.service_type == 'origin' )"
  64. - debug: var=docker_version