summaryrefslogtreecommitdiff
path: root/roles/kubernetes/base/tasks/main.yml
blob: da5f74083e9723711d035a55ae985e2aff30ce47 (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
52
53
54
55
56
57
58
59
---
- name: install container runtime
  include_tasks: "cri_{{ kubernetes_container_runtime }}.yml"

- name: prepare /var/lib/kubelet as LVM
  when: kubelet_lvm is defined
  import_tasks: lvm.yml

- name: prepare /var/lib/kubelet as ZFS dataset
  when: kubelet_zfs is defined
  import_tasks: zfs.yml

- name: add debian repository
  include_role:
    name: apt-repo/kubernetes

- name: install kubelet and common packages
  apt:
    name:
      - bridge-utils
      - cri-tools
      - "kubelet={{ kubernetes_version }}-00"
    state: present
    force: yes

- name: disable automatic upgrades for kubelet
  dpkg_selections:
    name: kubelet
    selection: hold

- name: add crictl config for shells
  loop:
    - zsh
    - bash
  blockinfile:
    path: "/root/.{{ item }}rc"
    create: yes
    marker: "### {mark} ANSIBLE MANAGED BLOCK for crictl ###"
    content: |
      {% if kubernetes_cri_socket %}
      alias crictl="crictl --runtime-endpoint {{ kubernetes_cri_socket }}"
      {% endif %}
      {% 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 990
  group:
    name: app
    gid: 990

- name: add dummy user with uid 990
  user:
    name: app
    uid: 990
    group: app
    password: "!"