diff options
author | Christian Pointner <equinox@spreadspace.org> | 2019-10-10 23:36:51 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2019-10-10 23:37:00 +0200 |
commit | 6d65dac3d747cd126eaa71463237f290b12360f3 (patch) | |
tree | bbd37676079469e443e05774bca0118aaa4657b6 /roles/kubernetes/base/tasks/main.yml | |
parent | added zfs support for docker (diff) |
added role for containerd and improve kubernetes/base
Diffstat (limited to 'roles/kubernetes/base/tasks/main.yml')
-rw-r--r-- | roles/kubernetes/base/tasks/main.yml | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/roles/kubernetes/base/tasks/main.yml b/roles/kubernetes/base/tasks/main.yml index 0b0be821..375bb63e 100644 --- a/roles/kubernetes/base/tasks/main.yml +++ b/roles/kubernetes/base/tasks/main.yml @@ -1,25 +1,11 @@ --- - name: prepare /var/lib/kubelet as LVM when: kubelet_lvm is defined - block: + import_tasks: lvm.yml - - name: create logical volume - lvol: - vg: "{{ kubelet_lvm.vg }}" - lv: "{{ kubelet_lvm.lv }}" - size: "{{ kubelet_lvm.size }}" - - - name: create filesystem - filesystem: - fstype: "{{ kubelet_lvm.fs }}" - dev: "/dev/mapper/{{ kubelet_lvm.vg | replace('-', '--') }}-{{ kubelet_lvm.lv | replace('-', '--') }}" - - - name: mount filesytem - mount: - src: "/dev/mapper/{{ kubelet_lvm.vg | replace('-', '--') }}-{{ kubelet_lvm.lv | replace('-', '--') }}" - path: /var/lib/kubelet - fstype: "{{ kubelet_lvm.fs }}" - state: mounted +- name: prepare /var/lib/kubelet as ZFS dataset + when: kubelet_zfs is defined + import_tasks: zfs.yml - name: install apt https transport apt: @@ -35,17 +21,19 @@ - name: add repository entry copy: content: | - deb http://apt.kubernetes.io/ kubernetes-xenial main + deb https://apt.kubernetes.io/ kubernetes-xenial main dest: /etc/apt/sources.list.d/kubernetes.list notify: update apt cache - name: update apt cache meta: flush_handlers -- name: install kubelet +- name: install kubelet and utils apt: name: - "kubelet{% if kubernetes.pkg_version is defined %}={{ kubernetes.pkg_version }}{% endif %}" + - cri-tools + - bridge-utils state: present - name: disable automatic upgrades for kubelet @@ -56,6 +44,23 @@ name: "{{ item }}" selection: hold +- name: configure crictl to use containerd + when: kubernetes_container_runtime == 'containerd' + loop: + - zsh + - bash + blockinfile: + path: "/root/.{{ item }}rc" + create: yes + marker: "### {mark} ANSIBLE MANAGED BLOCK for crictl ###" + content: | + alias crictl="crictl --runtime-endpoint unix:///run/containerd/containerd.sock" + {% if item == 'zsh' %} + ## TODO: see https://github.com/kubernetes-sigs/cri-tools/issues/435 + autoload -U +X bashcompinit && bashcompinit + {% endif %} + source <(crictl completion) + - name: add dummy group with gid 998 group: name: app |