# Copyright 2019 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. --- - name: Create CNI directory file: state: directory path: /opt/cni/bin mode: 0755 owner: root group: root - name: Download CNI tarball get_url: url: "{{ kubernetes_cni_http_source }}/{{ kubernetes_cni_semver }}/cni-plugins-linux-{{ kubernetes_goarch }}-{{ kubernetes_cni_semver }}.tgz" checksum: "{{ kubernetes_cni_http_checksum }}" dest: /tmp/cni.tar.gz mode: 0755 owner: root group: root - name: Install CNI unarchive: remote_src: yes dest: /opt/cni/bin src: /tmp/cni.tar.gz - name: Remove CNI tarball file: state: absent path: /tmp/cni.tar.gz - name: Download Kubernetes binaries get_url: url: "{{ kubernetes_http_source }}/{{ kubernetes_semver }}/bin/linux/{{ kubernetes_goarch }}/{{ item }}" # TODO(akutz) Write a script to separately download the checksum # and verify the associated file using the correct # checksum file format #checksum: "sha1:{{ kubernetes_http_source }}/bin/linux/amd64/{{ item }}.sha1" dest: "{{ sysusr_prefix }}/bin/{{ item }}" mode: 0755 owner: root group: root loop: "{{ kubernetes_bins }}" - name: Download Kubernetes images get_url: url: "{{ kubernetes_http_source }}/{{ kubernetes_semver }}/bin/linux/{{ kubernetes_goarch }}/{{ item }}" # TODO(akutz) Write a script to separately download the checksum # and verify the associated file using the correct # checksum file format #checksum: "sha1:{{ kubernetes_http_source }}/bin/linux/amd64/{{ item }}.sha1" dest: "/tmp/{{ item }}" mode: 0600 loop: "{{ kubernetes_imgs }}" - name: Load Kubernetes images shell: 'CONTAINERD_NAMESPACE="k8s.io" {{ sysusr_prefix }}/bin/ctr --address={{ containerd_cri_socket }} images import /tmp/{{ item }}' loop: "{{ kubernetes_imgs }}" - name: Remove Kubernetes images file: state: absent path: "/tmp/{{ item }}" loop: "{{ kubernetes_imgs }}" - name: Create Kubernetes manifests directory file: state: directory path: /etc/kubernetes/manifests mode: 0755 owner: root group: root - name: Create kubelet sysconfig directory file: state: directory path: /etc/sysconfig mode: 0755 owner: root group: root - name: Create kubelet drop-in directory file: state: directory path: "{{ systemd_prefix }}/system/kubelet.service.d" mode: 0755 owner: root group: root - name: Create kubelet kubeadm drop-in file template: src: usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf dest: "{{ systemd_prefix }}/system/kubelet.service.d/10-kubeadm.conf" owner: root group: root mode: 0644 - name: Create kubelet systemd file template: src: usr/lib/systemd/system/kubelet.service dest: "{{ systemd_prefix }}/system/kubelet.service" owner: root group: root mode: 0644