|
| 1 | +--- |
| 2 | +- hosts: all |
| 3 | + become: true |
| 4 | + tasks: |
| 5 | + - include_vars: vars/vars.yaml # Contains tasks variables for installer |
| 6 | + - include: tasks/bootstrap_ubuntu.yaml # Contains tasks bootstrap components for ubuntu systems |
| 7 | + when: ansible_distribution == "Ubuntu" |
| 8 | + - include: tasks/bootstrap_centos.yaml # Contains tasks bootstrap components for centos systems |
| 9 | + when: ansible_distribution == "CentOS" |
| 10 | + - include: tasks/k8s.yaml # Contains tasks kubernetes component installation |
| 11 | + - include: tasks/binaries.yaml # Contains tasks for pulling containerd and cri-containerd components |
| 12 | + |
| 13 | + - name: "Start Containerd" |
| 14 | + systemd: name=containerd daemon_reload=yes state=started enabled=yes |
| 15 | + |
| 16 | + - name: "Start CRI-Containerd" |
| 17 | + systemd: name=cri-containerd daemon_reload=yes state=started enabled=yes |
| 18 | + |
| 19 | + - name: "Set bridge-nf-call-iptables" |
| 20 | + lineinfile: |
| 21 | + line: "net/bridge/bridge-nf-call-iptables = 1" |
| 22 | + dest: /etc/sysctl.conf |
| 23 | + insertafter: 'EOF' |
| 24 | + regexp: '\/net\/bridge\/bridge-nf-call-iptables = 1' |
| 25 | + state: present |
| 26 | + ignore_errors: true |
| 27 | + |
| 28 | + - name: "Check kubelet args in kubelet config" |
| 29 | + shell: grep "^Environment=\"KUBELET_EXTRA_ARGS=" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf |
| 30 | + ignore_errors: true |
| 31 | + register: check_args |
| 32 | + |
| 33 | + - name: "Add runtime args in kubelet conf" |
| 34 | + lineinfile: |
| 35 | + dest: "/etc/systemd/system/kubelet.service.d/10-kubeadm.conf" |
| 36 | + line: "Environment=\"KUBELET_EXTRA_ARGS= --container-runtime=remote --runtime-request-timeout=15m --image-service-endpoint=/var/run/cri-containerd.sock --container-runtime-endpoint=/var/run/cri-containerd.sock\"" |
| 37 | + insertafter: '\[Service\]' |
| 38 | + when: check_args.stdout == "" |
| 39 | + |
| 40 | + - name: "Start Kubelet" |
| 41 | + systemd: name=kubelet daemon_reload=yes state=started enabled=yes |
| 42 | + |
| 43 | + # TODO This needs to be removed once we have consistent concurrent pull results |
| 44 | + - name: "Pre-pull pause container image" |
| 45 | + shell: | |
| 46 | + /usr/local/bin/ctr pull gcr.io/google_containers/pause:3.0 |
| 47 | + /usr/local/bin/crictl --runtime-endpoint /var/run/cri-containerd.sock \ |
| 48 | + pull gcr.io/google_containers/pause:3.0 |
0 commit comments