aboutsummaryrefslogtreecommitdiffstats
path: root/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/workers.yml
diff options
context:
space:
mode:
authorSridhar Rao <sridhar.rao@spirent.com>2020-07-22 13:09:57 +0000
committerGerrit Code Review <gerrit@opnfv.org>2020-07-22 13:09:57 +0000
commit1fe9ace8ff03f71d47e156c1cf82dbb07fe96c27 (patch)
tree490ba4d59b245fd6811109ea4d576e9bf82ddac5 /tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/workers.yml
parent6801918e1ca373e61eb081d1d577cbb092a7d234 (diff)
parent4c29bee136718738ca012278588e18e95e120e0b (diff)
Merge "TOOLS: Ansible Playbook for Deployed Kubernetes Cluster."
Diffstat (limited to 'tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/workers.yml')
-rw-r--r--tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/workers.yml15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/workers.yml b/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/workers.yml
new file mode 100644
index 00000000..a0a815c4
--- /dev/null
+++ b/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/workers.yml
@@ -0,0 +1,15 @@
+---
+- name: check node is already in cluster
+ delegate_to: "{{ groups.master[0] }}"
+ command: "kubectl get nodes -n kube-system -o name"
+ register: get_node_register
+ changed_when: false
+
+- name: get join command
+ delegate_to: "{{ groups.master[0] }}"
+ command: kubeadm token create --print-join-command
+ register: join_command_raw
+
+- name: join cluster
+ shell: "sudo {{ join_command_raw.stdout_lines[0] }} --ignore-preflight-errors=all > $HOME/node_joined.txt"
+ when: ( 'node/' + ansible_hostname ) not in get_node_register.stdout_lines