58 lines
1.7 KiB
YAML
58 lines
1.7 KiB
YAML
---
|
|
- name: Containerd | Add Docker CE repo
|
|
ansible.builtin.get_url:
|
|
url: https://download.docker.com/linux/rhel/docker-ce.repo
|
|
dest: /etc/yum.repos.d/docker-ce.repo
|
|
mode: "0644"
|
|
|
|
- name: Containerd | Disable conflicting container-tools module
|
|
ansible.builtin.command: dnf module disable container-tools -y
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Containerd | Install containerd.io
|
|
ansible.builtin.dnf:
|
|
name: "{{ 'containerd.io-' + containerd_version if containerd_version != '' else 'containerd.io' }}"
|
|
state: present
|
|
update_cache: true
|
|
disablerepo: kubernetes
|
|
|
|
- name: Containerd | Ensure runc is available at path expected by containerd
|
|
ansible.builtin.shell: |
|
|
RUNC_BIN=$(which runc 2>/dev/null || echo "")
|
|
if [ -n "$RUNC_BIN" ] && [ ! -f /usr/local/bin/runc ]; then
|
|
ln -sf "$RUNC_BIN" /usr/local/bin/runc
|
|
fi
|
|
changed_when: false
|
|
|
|
- name: Containerd | Remove default config
|
|
ansible.builtin.file:
|
|
dest: /etc/containerd/config.toml
|
|
state: absent
|
|
|
|
- name: Containerd | Generate default config
|
|
ansible.builtin.shell: containerd config default > /etc/containerd/config.toml
|
|
args:
|
|
creates: /etc/containerd/config.toml
|
|
|
|
- name: Containerd | Enable SystemdCgroup
|
|
ansible.builtin.replace:
|
|
path: /etc/containerd/config.toml
|
|
regexp: 'SystemdCgroup = false'
|
|
replace: 'SystemdCgroup = true'
|
|
notify: restart containerd
|
|
|
|
- name: Containerd | Enable SystemdCgroup
|
|
ansible.builtin.replace:
|
|
path: /etc/containerd/config.toml
|
|
regexp: 'disabled_plugins = ["cri"]'
|
|
replace: 'disabled_plugins = []'
|
|
notify: restart containerd
|
|
|
|
- name: Containerd | Enable and start service
|
|
ansible.builtin.systemd:
|
|
name: containerd
|
|
enabled: true
|
|
state: started
|
|
daemon_reload: true
|