blob: 26acea661687b14b1bc42ffdb48e16d74db612f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
---
- 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
|