package_crio.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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: Set pause_image to pod image
  42. ini_file:
  43. dest: /etc/crio/crio.conf
  44. section: "crio.image"
  45. option: pause_image
  46. value: '"{{ openshift_crio_pause_image }}"'
  47. - name: Set pause_command to pod cmd
  48. ini_file:
  49. dest: /etc/crio/crio.conf
  50. section: "crio.image"
  51. option: pause_command
  52. value: ' "/usr/bin/pod"'
  53. - name: Update crictl.yaml runtime-endpoint
  54. yedit:
  55. src: /etc/crictl.yaml
  56. key: runtime-endpoint
  57. value: "{{ openshift_crio_var_sock }}"
  58. - name: Ensure CNI configuration directory exists
  59. file:
  60. path: /etc/cni/net.d/
  61. state: directory
  62. - name: setup firewall for CRI-O
  63. import_tasks: crio_firewall.yml
  64. - name: Configure the CNI network
  65. template:
  66. dest: /etc/cni/net.d/openshift-sdn.conf
  67. src: 80-openshift-sdn.conf.j2
  68. when: r_crio_use_openshift_sdn | bool
  69. - name: Create /etc/sysconfig/crio-network
  70. template:
  71. dest: /etc/sysconfig/crio-network
  72. src: crio-network.j2
  73. - name: Place registries.conf in /etc/containers/registries.conf
  74. template:
  75. dest: "{{ containers_registries_conf_path }}"
  76. src: registries.conf.j2
  77. - name: Start the CRI-O service
  78. systemd:
  79. name: "cri-o"
  80. enabled: yes
  81. state: restarted
  82. daemon_reload: yes
  83. register: start_result
  84. # If we are using crio only, docker.service might not be available for
  85. # 'docker login'
  86. - import_tasks: common/post.yml