mirror of
https://github.com/Noratrieb/vmlab.git
synced 2026-01-14 16:45:11 +01:00
more stuff
This commit is contained in:
parent
64cb1dd6df
commit
0b4e5f1e27
15 changed files with 122 additions and 153 deletions
|
|
@ -4,3 +4,5 @@
|
|||
become: true
|
||||
roles:
|
||||
- update
|
||||
- base-config
|
||||
- k8s-base
|
||||
|
|
|
|||
9
ansible/roles/base-config/tasks/main.yml
Normal file
9
ansible/roles/base-config/tasks/main.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
- name: Change hostname
|
||||
ansible.builtin.hostname:
|
||||
name: "{{ hostname }}"
|
||||
- name: Install core packages
|
||||
ansible.builtin.apt:
|
||||
state: present
|
||||
name: "{{ item }}"
|
||||
with_items:
|
||||
- gpg
|
||||
1
ansible/roles/k8s-base/defaults/main.yml
Normal file
1
ansible/roles/k8s-base/defaults/main.yml
Normal file
|
|
@ -0,0 +1 @@
|
|||
cni_plugins_version: "v1.4.0"
|
||||
3
ansible/roles/k8s-base/files/containerd-config.toml
Normal file
3
ansible/roles/k8s-base/files/containerd-config.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
|
||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
||||
SystemdCgroup = true
|
||||
4
ansible/roles/k8s-base/handlers/main.yml
Normal file
4
ansible/roles/k8s-base/handlers/main.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- name: "Containerd config changed"
|
||||
ansible.builtin.service:
|
||||
name: containerd
|
||||
state: reloaded
|
||||
62
ansible/roles/k8s-base/tasks/main.yml
Normal file
62
ansible/roles/k8s-base/tasks/main.yml
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# ====================
|
||||
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
|
||||
- name: Add K8s key
|
||||
ansible.builtin.apt_key:
|
||||
url: "https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key"
|
||||
keyring: /etc/apt/keyrings/kubernetes-apt-keyring.gpg
|
||||
- name: Add K8s apt repo
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /"
|
||||
filename: kubernetes
|
||||
- name: Install K8s tools
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- kubelet
|
||||
- kubeadm
|
||||
- kubectl
|
||||
- name: Hold kubeadm
|
||||
ansible.builtin.dpkg_selections:
|
||||
name: "{{ item }}"
|
||||
selection: hold
|
||||
loop:
|
||||
- kubelet
|
||||
- kubeadm
|
||||
- kubectl
|
||||
# ====================
|
||||
# https://github.com/containerd/containerd/blob/main/docs/getting-started.md
|
||||
# https://docs.docker.com/engine/install/ubuntu/
|
||||
- name: Add docker key
|
||||
ansible.builtin.command:
|
||||
cmd: "curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc"
|
||||
creates: /etc/apt/keyrings/docker.asc
|
||||
- name: Add Docker apt repo
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu jammy stable"
|
||||
filename: docker
|
||||
- name: Install containerd/runc
|
||||
ansible.builtin.apt:
|
||||
name: containerd.io
|
||||
- name: Configure containerd to use systemd cgroups
|
||||
ansible.builtin.copy:
|
||||
src: "containerd-config.toml"
|
||||
dest: "/etc/containerd/config.toml"
|
||||
mode: "u=r,g=r,o=r"
|
||||
notify:
|
||||
- "Containerd config changed"
|
||||
- name: Create /opt/cni/bin
|
||||
ansible.builtin.file:
|
||||
path: /opt/cni/bin
|
||||
state: directory
|
||||
mode: "u=rwx,g=rx,o=rx"
|
||||
- name: Download CNI plugins
|
||||
ansible.builtin.get_url:
|
||||
url: "https://github.com/containernetworking/plugins/releases/download/{{ cni_plugins_version }}/cni-plugins-linux-amd64-{{ cni_plugins_version }}.tgz"
|
||||
dest: "/tmp/cni-plugins-linux-amd64-{{ cni_plugins_version }}.tgz"
|
||||
- name: Install CNI plugins
|
||||
ansible.builtin.command:
|
||||
cmd: "tar Cxzvf /opt/cni/bin /tmp/cni-plugins-linux-amd64-{{ cni_plugins_version }}.tgz"
|
||||
creates: /opt/cni/bin/tap
|
||||
- name: Start contained
|
||||
ansible.builtin.service:
|
||||
state: started
|
||||
name: containerd
|
||||
Loading…
Add table
Add a link
Reference in a new issue