package_crio.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ---
  2. - import_tasks: common/pre.yml
  3. - name: Check that overlay is in the kernel
  4. shell: lsmod | grep overlay
  5. register: l_has_overlay_in_kernel
  6. ignore_errors: yes
  7. failed_when: false
  8. - when: l_has_overlay_in_kernel.rc != 0
  9. block:
  10. - name: Add overlay to modprobe.d
  11. template:
  12. dest: /etc/modules-load.d/overlay.conf
  13. src: overlay.conf.j2
  14. backup: yes
  15. - name: Manually modprobe overlay into the kernel
  16. command: modprobe overlay
  17. - name: Enable and start systemd-modules-load
  18. service:
  19. name: systemd-modules-load
  20. enabled: yes
  21. state: restarted
  22. - name: Install cri-o
  23. package:
  24. name: "{{ pkg_list | join(',') }}"
  25. state: latest
  26. register: result
  27. until: result is succeeded
  28. vars:
  29. pkg_list:
  30. - cri-o
  31. - cri-tools
  32. - skopeo
  33. - podman
  34. - name: Remove CRI-O default configuration files
  35. file:
  36. path: "{{ item }}"
  37. state: absent
  38. with_items:
  39. - /etc/cni/net.d/200-loopback.conf
  40. - /etc/cni/net.d/100-crio-bridge.conf
  41. - name: Create the CRI-O configuration
  42. template:
  43. dest: /etc/crio/crio.conf
  44. src: crio.conf.j2
  45. backup: yes
  46. - name: Update crictl.yaml runtime-endpoint
  47. yedit:
  48. src: /etc/crictl.yaml
  49. key: runtime-endpoint
  50. value: "{{ openshift_crio_var_sock }}"
  51. - name: Ensure CNI configuration directory exists
  52. file:
  53. path: /etc/cni/net.d/
  54. state: directory
  55. - name: setup firewall for CRI-O
  56. import_tasks: crio_firewall.yml
  57. - name: Configure the CNI network
  58. template:
  59. dest: /etc/cni/net.d/openshift-sdn.conf
  60. src: 80-openshift-sdn.conf.j2
  61. when: r_crio_use_openshift_sdn | bool
  62. - name: Create /etc/sysconfig/crio-network
  63. template:
  64. dest: /etc/sysconfig/crio-network
  65. src: crio-network.j2
  66. - name: Place registries.conf in /etc/containers/registries.conf
  67. template:
  68. dest: "{{ containers_registries_conf_path }}"
  69. src: registries.conf.j2
  70. - name: Start the CRI-O service
  71. systemd:
  72. name: "cri-o"
  73. enabled: yes
  74. state: restarted
  75. daemon_reload: yes
  76. register: start_result
  77. # If we are using crio only, docker.service might not be available for
  78. # 'docker login'
  79. - import_tasks: common/post.yml