Deploy multiple clusters in one time
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7f36b6eae6
commit
2ce6678959
2 changed files with 43 additions and 32 deletions
|
|
@ -1,4 +1,17 @@
|
|||
---
|
||||
- name: Add master to KubernetesMasters_ClusterName group
|
||||
group_by:
|
||||
key: KubernetesMasters_{{ kubernetes_cluster_name }}
|
||||
when:
|
||||
- "'KubernetesMasters' in group_names"
|
||||
|
||||
- name: Add node to KubernetesNodes_ClusterName group
|
||||
group_by:
|
||||
key: KubernetesNodes_{{ kubernetes_cluster_name }}
|
||||
when:
|
||||
- "'KubernetesNodes' in group_names"
|
||||
|
||||
|
||||
- name: Disable SWAP since kubernetes can't work with swap enabled (1/2)
|
||||
command: swapoff -a
|
||||
changed_when: false
|
||||
|
|
@ -15,11 +28,11 @@
|
|||
thinpool: kubernetes
|
||||
size: 20g
|
||||
|
||||
# Install API loadbalancer
|
||||
- include_tasks: "load_balancer.yml"
|
||||
when:
|
||||
- kubernetes_master|bool
|
||||
- groups['KubernetesMasters'] | length > 1
|
||||
## Install API loadbalancer
|
||||
#- include_tasks: "load_balancer.yml"
|
||||
# when:
|
||||
# - kubernetes_master|bool
|
||||
# - groups['KubernetesMasters'] | length > 1
|
||||
|
||||
- name: Kubernetes cluster with kubeadm
|
||||
include_tasks: "cluster_kubeadm.yml"
|
||||
|
|
@ -82,12 +95,13 @@
|
|||
- name: Check if a node is still tainted
|
||||
command: kubectl --kubeconfig=/etc/kubernetes/admin.conf get nodes '{{ ansible_hostname | lower }}' -o jsonpath='{.spec.taints}'
|
||||
register: current_taint
|
||||
check_mode: no
|
||||
when:
|
||||
- kubernetes_master_taint|bool
|
||||
|
||||
- name: taint the machine if needed
|
||||
# command: kubectl --kubeconfig=/etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
|
||||
command: kubectl taint nodes '{{ ansible_hostname | lower }}' node-role.kubernetes.io/master-
|
||||
command: kubectl --kubeconfig=/etc/kubernetes/admin.conf taint nodes '{{ ansible_hostname | lower }}' node-role.kubernetes.io/master-
|
||||
when:
|
||||
- kubernetes_master_taint|bool
|
||||
- current_taint.stdout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue