systemcontainer_crio.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ---
  2. # TODO: Much of this file is shared with container engine tasks
  3. - set_fact:
  4. l_insecure_crio_registries: "{{ '\"{}\"'.format('\", \"'.join(openshift.docker.insecure_registries)) }}"
  5. when: openshift.docker.insecure_registries
  6. - name: Ensure container-selinux is installed
  7. package:
  8. name: container-selinux
  9. state: present
  10. when: not openshift.common.is_atomic | bool
  11. # Used to pull and install the system container
  12. - name: Ensure atomic is installed
  13. package:
  14. name: atomic
  15. state: present
  16. when: not openshift.common.is_atomic | bool
  17. # At the time of writing the atomic command requires runc for it's own use. This
  18. # task is here in the even that the atomic package ever removes the dependency.
  19. - name: Ensure runc is installed
  20. package:
  21. name: runc
  22. state: present
  23. when: not openshift.common.is_atomic | bool
  24. - block:
  25. - name: Add http_proxy to /etc/atomic.conf
  26. lineinfile:
  27. dest: /etc/atomic.conf
  28. regexp: "^#?http_proxy[:=]{1}"
  29. line: "http_proxy: {{ openshift.common.http_proxy | default('') }}"
  30. when:
  31. - openshift.common.http_proxy is defined
  32. - openshift.common.http_proxy != ''
  33. - name: Add https_proxy to /etc/atomic.conf
  34. lineinfile:
  35. dest: /etc/atomic.conf
  36. regexp: "^#?https_proxy[:=]{1}"
  37. line: "https_proxy: {{ openshift.common.https_proxy | default('') }}"
  38. when:
  39. - openshift.common.https_proxy is defined
  40. - openshift.common.https_proxy != ''
  41. - name: Add no_proxy to /etc/atomic.conf
  42. lineinfile:
  43. dest: /etc/atomic.conf
  44. regexp: "^#?no_proxy[:=]{1}"
  45. line: "no_proxy: {{ openshift.common.no_proxy | default('') }}"
  46. when:
  47. - openshift.common.no_proxy is defined
  48. - openshift.common.no_proxy != ''
  49. - block:
  50. - name: Set to default prepend
  51. set_fact:
  52. l_crio_image_prepend: "gscrivano"
  53. - name: Use Red Hat Registry for image when distribution is Red Hat
  54. set_fact:
  55. l_crio_image_prepend: "registry.access.redhat.com/openshift3"
  56. when: ansible_distribution == 'RedHat'
  57. - name: Use Fedora Registry for image when distribution is Fedora
  58. set_fact:
  59. l_crio_image_prepend: "registry.fedoraproject.org/f25"
  60. when: ansible_distribution == 'Fedora'
  61. # For https://github.com/openshift/openshift-ansible/pull/4049#discussion_r114478504
  62. - name: Use a testing registry if requested
  63. set_fact:
  64. l_crio_image_prepend: "{{ openshift_docker_systemcontainer_image_registry_override }}"
  65. when:
  66. - openshift_docker_systemcontainer_image_registry_override is defined
  67. - openshift_docker_systemcontainer_image_registry_override != ""
  68. - name: Set the full image name
  69. set_fact:
  70. l_crio_image: "{{ l_crio_image_prepend }}/cri-o:latest"
  71. # NOTE: no_proxy added as a workaround until https://github.com/projectatomic/atomic/pull/999 is released
  72. - name: Pre-pull CRI-O System Container image
  73. command: "atomic pull --storage ostree {{ l_crio_image }}"
  74. changed_when: false
  75. environment:
  76. NO_PROXY: "{{ openshift.common.no_proxy | default('') }}"
  77. - name: Install CRI-O System Container
  78. oc_atomic_container:
  79. name: "cri-o"
  80. image: "{{ l_crio_image }}"
  81. state: latest
  82. - name: Create the CRI-O configuration
  83. template:
  84. dest: /etc/crio/crio.conf
  85. src: crio.conf.j2
  86. backup: yes
  87. - name: Start the CRI-O service
  88. systemd:
  89. name: "cri-o"
  90. enabled: yes
  91. state: started
  92. daemon_reload: yes
  93. register: start_result
  94. - meta: flush_handlers