From 0c16a178e5c0cdd4eb899c10318fd71c3e246c10 Mon Sep 17 00:00:00 2001 From: savagebidoof Date: Thu, 7 Mar 2024 04:35:41 +0100 Subject: [PATCH] Added "is_proxmox_vm" and "setup_only" to prevent joining/creating a kubernetes cluster --- ksetup/playbook.yaml | 15 ++++++++++----- ksetup/tasks_prepare_node.yaml | 8 +++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ksetup/playbook.yaml b/ksetup/playbook.yaml index c52ab73..39a67c7 100755 --- a/ksetup/playbook.yaml +++ b/ksetup/playbook.yaml @@ -10,10 +10,11 @@ vars: # Testing purposes - ansible_user: "my_user" # Testing purposes - ansible_password: "my_password" # Testing purposes + ansible_user: "adminuser" # Testing purposes + ansible_password: "adminpassword" # Testing purposes ansible_become_password: "{{ ansible_password }}" # Testing purposes + # Actual vars set_hostname: "{{ ansible_host }}" # is_master: Figurative @@ -22,6 +23,10 @@ kubeadm_join_path: "./Exported/kubeadm-join.command" _kubeadm_join_command: "" # Placeholder + # Others + is_proxmox_vm: "{{ is_proxmox_vm }} | default(false) | bool" + setup_only: "{{ setup_only }} | default(false) | bool" # Prevent creating/joining a cluster + tasks: # - check vars - debug: var=set_hostname @@ -29,7 +34,7 @@ - name: Ping check ping: -# + # Init / Basic setup - name: set up node import_tasks: tasks_prepare_node.yaml @@ -38,13 +43,13 @@ # If is_master: init - name: init cluster import_tasks: tasks_master.yaml - when: is_master + when: is_master and not setup_only become: true # else: join - name: join cluster import_tasks: tasks_slave.yaml - when: not is_master + when: not is_master and not setup_only # Do other stuff - name: post setup diff --git a/ksetup/tasks_prepare_node.yaml b/ksetup/tasks_prepare_node.yaml index 0d0433e..e053d59 100755 --- a/ksetup/tasks_prepare_node.yaml +++ b/ksetup/tasks_prepare_node.yaml @@ -194,7 +194,7 @@ name: containerd enabled: true -### Restart +### Restart containerd - name: Enable kubelet ansible.builtin.systemd: name: kubelet @@ -220,3 +220,9 @@ ff02::2 ip6-allrouters +## ProxmoxVM related +- name: Install Kubelet Kubeadm Kubectl + ansible.builtin.apt: + pkg: + - qemu-guest-agent + when: is_proxmox_vm