# Copyright 2018 The Kubernetes Authors. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. --- - import_tasks: debian.yml when: kubernetes_source_type == "pkg" and ansible_os_family == "Debian" - import_tasks: redhat.yml when: kubernetes_source_type == "pkg" and ansible_os_family == "RedHat" - import_tasks: photon.yml when: kubernetes_source_type == "pkg" and ansible_os_family == "VMware Photon OS" - name: Symlink cri-tools file: src: "/usr/local/bin/{{ item }}" dest: "/usr/bin/{{ item }}" mode: 0777 state: link force: yes loop: - ctr - crictl - critest when: ansible_os_family != "Flatcar" - import_tasks: url.yml when: kubernetes_source_type == "http" and kubernetes_cni_source_type == "http" # must include crictl-url.yml after installing containerd, # as the cri-containerd tarball also includes crictl. - import_tasks: crictl-url.yml when: crictl_source_type == "http" - name: Create kubelet default config file template: src: etc/sysconfig/kubelet dest: "{{ '/etc/default/kubelet' if ansible_os_family == 'Debian' else '/etc/sysconfig/kubelet'}}" owner: root group: root mode: 0644 - name: Enable kubelet service systemd: name: kubelet daemon_reload: yes enabled: True state: stopped - name: Create the Kubernetes version file template: dest: /etc/kubernetes-version src: etc/kubernetes-version mode: 0644 # TODO: This section will be deprecated once https://github.com/containerd/cri/issues/1131 is fixed. It is used to support ECR with containerd. - name: Check if Kubernetes container registry is using Amazon ECR set_fact: ecr: '{{ kubernetes_container_registry is regex("^[0-9]{12}.dkr.ecr.[^.]+.amazonaws.com$") }}' - import_tasks: kubeadmpull.yml when: (kubernetes_source_type == "pkg" and ecr != true) or ansible_os_family == "Flatcar" - import_tasks: ecrpull.yml when: kubernetes_source_type != "http" and ecr == true