diff options
Diffstat (limited to 'roles/containerd/tasks')
-rw-r--r-- | roles/containerd/tasks/lvm.yml | 18 | ||||
-rw-r--r-- | roles/containerd/tasks/main.yml | 34 | ||||
-rw-r--r-- | roles/containerd/tasks/zfs.yml | 21 |
3 files changed, 28 insertions, 45 deletions
diff --git a/roles/containerd/tasks/lvm.yml b/roles/containerd/tasks/lvm.yml deleted file mode 100644 index 93be2656..00000000 --- a/roles/containerd/tasks/lvm.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- name: create logical volume - lvol: - vg: "{{ containerd_storage.vg }}" - lv: "{{ containerd_storage.lv }}" - size: "{{ containerd_storage.size }}" - -- name: create filesystem - filesystem: - fstype: "{{ containerd_storage.fs }}" - dev: "/dev/mapper/{{ containerd_storage.vg | replace('-', '--') }}-{{ containerd_storage.lv | replace('-', '--') }}" - -- name: mount filesytem - mount: - src: "/dev/mapper/{{ containerd_storage.vg | replace('-', '--') }}-{{ containerd_storage.lv | replace('-', '--') }}" - path: /var/lib/containerd - fstype: "{{ containerd_storage.fs }}" - state: mounted diff --git a/roles/containerd/tasks/main.yml b/roles/containerd/tasks/main.yml index f0d29a4a..ab23bd96 100644 --- a/roles/containerd/tasks/main.yml +++ b/roles/containerd/tasks/main.yml @@ -1,15 +1,37 @@ --- -- name: check for supported platform - when: ansible_distribution != "Ubuntu" - fail: - msg: "currenty this only works with ubuntu" +- name: install containerd config + when: containerd_config is defined + copy: + content: "{{ containerd_config | to_toml }}\n" + dest: /etc/containerd/config.toml + notify: restart containerd - name: prepare storage volume for /var/lib/containerd when: containerd_storage is defined - import_tasks: "{{ containerd_storage.type }}.yml" + vars: + storage_volume: "{{ containerd_storage | combine({'dest': '/var/lib/containerd'}) }}" + include_role: + name: "storage/{{ containerd_storage.type }}/volume" + +- name: prepare package provider + when: containerd_pkg_provider != 'distro' + include_role: + name: "apt-repo/{{ containerd_pkg_provider }}" - name: install containerd apt: - name: containerd + name: "{{ containerd_pkg_name }}{% if containerd_pkg_version is defined %}={{ containerd_pkg_version }}{% endif %}" state: present force: yes + +- name: disable automatic upgrades for containerd package + when: containerd_pkg_version is defined + dpkg_selections: + name: "{{ containerd_pkg_name }}" + selection: hold + +- name: start and enable containerd + service: + name: containerd + enabled: true + state: started diff --git a/roles/containerd/tasks/zfs.yml b/roles/containerd/tasks/zfs.yml deleted file mode 100644 index 7cf33639..00000000 --- a/roles/containerd/tasks/zfs.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -## containerd from ubuntu doesn't support zfs directly -## we need to create a volume and an ext4 fs on top of that... -- name: create zfs volume - zfs: - name: "{{ containerd_storage.pool }}/{{ containerd_storage.name }}" - state: present - extra_zfs_properties: "{{ containerd_storage.properties | default({}) | combine({'volsize': item.value.size}) }}" - -- name: create and ext4 filesystem on the zfs volume - filesystem: - fstype: ext4 - dev: "/dev/zvol/{{ containerd_storage.pool }}/{{ containerd_storage.name }}" - -- name: mount filesytem - mount: - src: "/dev/zvol/{{ containerd_storage.pool }}/{{ containerd_storage.name }}" - path: /var/lib/containerd - fstype: ext4 - opts: defaults,x-systemd.automount,nofail - state: mounted |