--- - name: prepare storage volume for /var/lib/containerd when: containerd_storage is defined vars: storage_volume: "{{ containerd_storage | combine({'dest': '/var/lib/containerd'}) }}" include_role: name: "storage/{{ containerd_storage.type }}/volume" - name: create child-dataset for zfs-snapshotter when: "containerd_storage is defined and containerd_storage.type == 'zfs'" zfs: name: "{{ containerd_storage.pool }}/{{ containerd_storage.name }}/io.containerd.snapshotter.v1.zfs" state: present - name: prepare package provider when: containerd_pkg_provider != 'distro' include_role: name: "apt-repo/{{ containerd_pkg_provider }}" - name: install containerd apt: name: "{{ containerd_pkg_name }}{% if containerd_pkg_version is defined %}={{ containerd_pkg_version }}{% endif %}" state: present force: yes ## TODO: remove force once the following changes are available ## https://github.com/ansible/ansible/pull/73629 or https://github.com/ansible/ansible/pull/72562 ## https://github.com/ansible/ansible/pull/74852 - name: disable automatic upgrades for containerd package when: containerd_pkg_version is defined dpkg_selections: name: "{{ containerd_pkg_name }}" selection: hold - name: fetch containerd default config check_mode: no command: containerd config default register: containerd_config_default changed_when: false - name: fetch containerd default config copy: content: "{{ containerd_config_default.stdout | from_toml | combine(containerd_config, recursive=True) | to_toml }}\n" dest: /etc/containerd/config.toml notify: restart containerd - name: start and enable containerd service: name: containerd enabled: true state: started