Added "is_proxmox_vm" and "setup_only" to prevent joining/creating a kubernetes cluster
This commit is contained in:
parent
d62eaa0014
commit
0c16a178e5
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user