ansible-role-containerd/tasks/main.yml
Adrien 6185bb26ee
Some checks failed
continuous-integration/drone/push Build is failing
Add LV
2020-09-13 23:40:09 +02:00

95 lines
2.3 KiB
YAML

---
- name: Include vars for {{ ansible_os_family }}
include_vars: "{{ ansible_os_family }}.yml"
- name: Remove all other's containerd version packages
package:
name: "{{ containerd_remove_packages_name }}"
state: absent
update_cache: yes
- name: Create thin volumes for containerd
lvol:
vg: {{ item.vg }}
lv: {{ item.name }}
thinpool: kubernetes
size: {{ item.size }}
with_items:
- { name: var_lib_containerd, vg: vg_sys, size: 10g, mount_point: /var/lib/containerd, mount_opts: "discard"}
- name: create file system on containerd lv
filesystem:
fstype: ext4
dev: /dev/{{ item.vg }}/{{ item.name }}
with_items:
- { name: var_lib_containerd, vg: vg_sys, size: 10g, mount_point: /var/lib/containerd, mount_opts: "discard"}
- name: mount logical volumes
mount:
name: {{ item.mount_point }}
src: /dev/{{ item.vg }}/{{ item.name }}
fstype: ext4
opts: {{ item.mount_opts }}
state: mounted
with_items:
- { name: var_lib_containerd, vg: vg_sys, size: 10g, mount_point: /var/lib/containerd, mount_opts: "discard"}
- name: Install containerd
package:
name: "{{ containerd_package_name }}"
state: present
update_cache: yes
notify: Restart containerd
- name: Enable containerd on boot
service:
name: containerd
state: started
enabled: yes
- name: Configuring kernel module to be load on boot
template:
src: "etc/modules-load.d/{{ item }}.conf.j2"
dest: "/etc/modules-load.d/{{ item }}.conf"
group: root
owner: root
mode: 0644
with_items:
- "br_netfilter"
- "overlay"
- name: Load kernel module
modprobe:
name: "{{ item }}"
state: present
with_items:
- br_netfilter
- overlay
- name: Configure sysctl
sysctl:
name: "{{ item }}"
value: "1"
sysctl_file: /etc/sysctl.d/99-kubernetes-cri.conf
reload: yes
with_items:
- "net.bridge.bridge-nf-call-iptables"
- "net.ipv4.ip_forward"
- "net.bridge.bridge-nf-call-ip6tables"
- name: Ensuring /etc/containerd folder exists
file:
path: "/etc/containerd"
state: "directory"
group: root
owner: root
mode: 0755
- name: Configuring containerd
template:
src: "etc/containerd/config.toml.j2"
dest: "/etc/containerd/config.toml"
group: root
owner: root
mode: 0644
notify: Restart containerd