You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.0 KiB
60 lines
2.0 KiB
- name: Setup HAProxy
|
|
hosts: all
|
|
become: yes
|
|
become_method: sudo
|
|
become_user: root
|
|
tasks:
|
|
- name: Install containerd
|
|
package:
|
|
name: containerd
|
|
state: present
|
|
- name: Install runc
|
|
package:
|
|
name: runc
|
|
state: present
|
|
- name: Creates directory
|
|
ansible.builtin.file:
|
|
path: /etc/containerd
|
|
state: directory
|
|
- name: Get containerd default config
|
|
command: containerd config default
|
|
register: containerd_config
|
|
- name: Create containerd config
|
|
copy:
|
|
dest: /etc/containerd/config.toml
|
|
content: "{{ containerd_config.stdout }}"
|
|
- name: Configure containerd
|
|
command: "{{ item }} chdir=/etc/"
|
|
with_items:
|
|
- sed -i 's/ SystemdCgroup = false/ SystemdCgroup = true/' /etc/containerd/config.toml
|
|
- name: Install CNI Plugins
|
|
command: "{{ item }} chdir=/tmp"
|
|
with_items:
|
|
- wget https://github.com/containernetworking/plugins/releases/download/v1.4.1/cni-plugins-linux-arm64-v1.4.1.tgz
|
|
- mkdir -p /opt/cni/bin
|
|
- tar Cxzvf /opt/cni/bin cni-plugins-linux-arm64-v1.4.1.tgz
|
|
- rm cni-plugins-linux-arm64-v1.4.1.tgz
|
|
- name: Restart containerd
|
|
service:
|
|
name: containerd
|
|
state: restarted
|
|
- name: Enable IPv4 Forwarding
|
|
copy:
|
|
dest: /etc/sysctl.d/k8s.conf
|
|
content: |
|
|
"net.ipv4.ip_forward = 1"
|
|
"net.bridge.bridge-nf-call-iptables = 1"
|
|
"net.bridge.bridge-nf-call-ip6tables = 1"
|
|
- name: Load required modules
|
|
copy:
|
|
dest: /etc/modules-load.d/k8s.conf
|
|
content: |
|
|
"overlay"
|
|
"br_netfilter"
|
|
- name: Install CriCtl
|
|
command: "{{ item }} chdir=/tmp"
|
|
with_items:
|
|
- "wget https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.30.0/crictl-v1.30.0-linux-arm64.tar.gz"
|
|
- "tar Cxzvf /usr/local/bin crictl-v1.30.0-linux-arm64.tar.gz"
|
|
- "rm crictl-v1.30.0-linux-arm64.tar.gz"
|
|
- "echo https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/" |