diff --git a/roles/container-engine/cri-o/handlers/main.yml b/roles/container-engine/cri-o/handlers/main.yml new file mode 100644 index 000000000..957e8e400 --- /dev/null +++ b/roles/container-engine/cri-o/handlers/main.yml @@ -0,0 +1,15 @@ +--- +- name: restart crio + command: /bin/true + notify: + - CRI-O | reload systemd + - CRI-O | reload crio + +- name: CRI-O | reload systemd + systemd: + daemon_reload: true + +- name: CRI-O | reload crio + service: + name: crio + state: restarted diff --git a/roles/container-engine/cri-o/tasks/main.yaml b/roles/container-engine/cri-o/tasks/main.yaml index 8764b6ec7..08de0c99d 100644 --- a/roles/container-engine/cri-o/tasks/main.yaml +++ b/roles/container-engine/cri-o/tasks/main.yaml @@ -54,6 +54,7 @@ with_items: - /etc/crio - /etc/containers + - /etc/systemd/system/crio.service.d file: path: "{{ item }}" state: directory @@ -64,6 +65,7 @@ state: present when: not is_ostree with_items: "{{ crio_packages }}" + notify: restart crio - name: Check if already installed stat: @@ -110,6 +112,7 @@ dest: /etc/containers/mounts.conf when: - ansible_os_family == 'RedHat' + notify: restart crio - name: Create directory for oci hooks file: @@ -118,12 +121,9 @@ owner: root mode: 0755 -- name: Reload systemd daemon - systemd: - daemon_reload: yes - -- name: Install cri-o service - service: - name: "{{ crio_service }}" - enabled: yes - state: restarted +- name: Write cri-o proxy drop-in + template: + src: http-proxy.conf.j2 + dest: /etc/systemd/system/crio.service.d/http-proxy.conf + notify: restart crio + when: http_proxy is defined or https_proxy is defined diff --git a/roles/container-engine/cri-o/templates/http-proxy.conf.j2 b/roles/container-engine/cri-o/templates/http-proxy.conf.j2 new file mode 100644 index 000000000..212f30f92 --- /dev/null +++ b/roles/container-engine/cri-o/templates/http-proxy.conf.j2 @@ -0,0 +1,2 @@ +[Service] +Environment={% if http_proxy is defined %}"HTTP_PROXY={{ http_proxy }}"{% endif %} {% if https_proxy is defined %}"HTTPS_PROXY={{ https_proxy }}"{% endif %} {% if no_proxy is defined %}"NO_PROXY={{ no_proxy }}"{% endif %} diff --git a/roles/container-engine/cri-o/vars/clearlinux.yml b/roles/container-engine/cri-o/vars/clearlinux.yml index 5f258da8e..c2060224e 100644 --- a/roles/container-engine/cri-o/vars/clearlinux.yml +++ b/roles/container-engine/cri-o/vars/clearlinux.yml @@ -2,7 +2,6 @@ crio_packages: - containers-basic -crio_service: crio crio_conmon: /usr/libexec/crio/conmon crio_seccomp_profile: /usr/share/defaults/crio/seccomp.json crio_runc_path: /usr/bin/runc diff --git a/roles/container-engine/cri-o/vars/fedora.yml b/roles/container-engine/cri-o/vars/fedora.yml index 59af9824b..f7927a29a 100644 --- a/roles/container-engine/cri-o/vars/fedora.yml +++ b/roles/container-engine/cri-o/vars/fedora.yml @@ -3,6 +3,5 @@ crio_packages: - cri-o - cri-tools -crio_service: cri-o crio_conmon: /usr/libexec/crio/conmon crio_seccomp_profile: "" diff --git a/roles/container-engine/cri-o/vars/redhat.yml b/roles/container-engine/cri-o/vars/redhat.yml index 1d0c62a8f..8f617c318 100644 --- a/roles/container-engine/cri-o/vars/redhat.yml +++ b/roles/container-engine/cri-o/vars/redhat.yml @@ -3,6 +3,5 @@ crio_packages: - cri-o - oci-systemd-hook -crio_service: crio crio_conmon: /usr/libexec/crio/conmon crio_runc_path: /usr/bin/runc diff --git a/roles/container-engine/cri-o/vars/ubuntu.yml b/roles/container-engine/cri-o/vars/ubuntu.yml index bc8f1f14c..689c07f53 100644 --- a/roles/container-engine/cri-o/vars/ubuntu.yml +++ b/roles/container-engine/cri-o/vars/ubuntu.yml @@ -2,7 +2,6 @@ crio_packages: - "cri-o-{{ kube_version | regex_replace('^v(?P\\d+).(?P\\d+).(?P\\d+)$', '\\g.\\g') }}" -crio_service: crio crio_conmon: /usr/libexec/podman/conmon crio_seccomp_profile: "" crio_runc_path: /usr/lib/cri-o-runc/sbin/runc