This commit is contained in:
2026-02-23 16:01:03 +01:00
parent 97af01e123
commit d41b8e5153

View File

@@ -135,12 +135,15 @@
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true SystemdCgroup = true
notify:
- restart containerd - name: Enable and start containerd
systemd:
name: containerd
state: restarted
- name: Pause for 5 minutes to build app cache - name: Pause for 5 minutes to build app cache
ansible.builtin.pause: ansible.builtin.pause:
minutes: 1 minutes: 2
- name: Create .kube directory - name: Create .kube directory
file: file:
@@ -151,6 +154,11 @@
mode: '0755' mode: '0755'
when: inventory_hostname == 'ubuntu24-vm01.home.lan' when: inventory_hostname == 'ubuntu24-vm01.home.lan'
- name: Initialize Kubernetes
command: sudo kubeadm init --pod-network-cidr=10.244.0.0/16
args:
creates: /etc/kubernetes/admin.conf
when: inventory_hostname == 'ubuntu24-vm01.home.lan'
- name: Copy kubeconfig to user - name: Copy kubeconfig to user
@@ -164,20 +172,17 @@
when: inventory_hostname == 'ubuntu24-vm01.home.lan' when: inventory_hostname == 'ubuntu24-vm01.home.lan'
- name: Install Flannel CNI - name: Install Flannel CNI
become_user: "{{ ansible_user }}"
command: kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml command: kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
when: inventory_hostname == 'ubuntu24-vm01.home.lan' when: inventory_hostname == 'ubuntu24-vm01.home.lan'
ignore_errors: true ignore_errors: true
- name: Get join command - name: Get join command
command: kubeadm token create --print-join-command command: sudo kubeadm token create --print-join-command
register: join_command register: join_command
when: inventory_hostname == 'ubuntu24-vm01.home.lan' when: inventory_hostname == 'ubuntu24-vm01.home.lan'
- name: Initialize Kubernetes
command: sudo kubeadm init --pod-network-cidr=10.244.0.0/16
args:
creates: /etc/kubernetes/admin.conf
when: inventory_hostname == 'ubuntu24-vm01.home.lan'