diff --git a/roles/container-engine/containerd/defaults/main.yml b/roles/container-engine/containerd/defaults/main.yml index da51a4cd02e07eb31b7fb9460aaa1ee488537424..2fb4afe900be3b39c20dbc140f7ffd2dd1981860 100644 --- a/roles/container-engine/containerd/defaults/main.yml +++ b/roles/container-engine/containerd/defaults/main.yml @@ -105,3 +105,6 @@ containerd_supported_distributions: - "UnionTech" - "UniontechOS" - "openEuler" + +# Enable container device interface +enable_cdi: false diff --git a/roles/container-engine/containerd/templates/config.toml.j2 b/roles/container-engine/containerd/templates/config.toml.j2 index cc43a3df601a612c31ff8ff1483f316fd6fa00ed..d1bb4abfb3f3d86ec6752fed91bf131f13dde4a8 100644 --- a/roles/container-engine/containerd/templates/config.toml.j2 +++ b/roles/container-engine/containerd/templates/config.toml.j2 @@ -20,6 +20,10 @@ oom_score = {{ containerd_oom_score }} max_container_log_line_size = {{ containerd_max_container_log_line_size }} enable_unprivileged_ports = {{ containerd_enable_unprivileged_ports | default(false) | lower }} enable_unprivileged_icmp = {{ containerd_enable_unprivileged_icmp | default(false) | lower }} +{% if enable_cdi %} + enable_cdi = true + cdi_spec_dirs = ["/etc/cdi", "/var/run/cdi"] +{% endif %} [plugins."io.containerd.grpc.v1.cri".containerd] default_runtime_name = "{{ containerd_default_runtime | default('runc') }}" snapshotter = "{{ containerd_snapshotter | default('overlayfs') }}"