summaryrefslogtreecommitdiffstats
path: root/tools/lma/ansible-server/roles/k8s-master/tasks/main.yml
blob: edc8f10b402bca7c9294745551981ecc522f2501 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Copyright 2020 Adarsh yadav, Aditya Srivastava
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
#pull k8s images
- name: Pulling images required for setting up a Kubernetes cluster
  shell: kubeadm config images pull

#reset k8s
- name: Resetting kubeadm
  shell: kubeadm reset -f

#init k8s
- name: Initializing Kubernetes cluster
  shell: kubeadm init --apiserver-advertise-address {{ad_addr}} --pod-network-cidr={{pod_cidr}}

#Copying required files
- name: Copying required files
  shell: |
   mkdir -p $HOME/.kube
   sudo cp -f /etc/kubernetes/admin.conf $HOME/.kube/config
   sudo chown $(id -u):$(id -g) $HOME/.kube/config

#get token
- name: Storing token for future purpose.
  shell: kubeadm token create --print-join-command
  register: token

#save token to join worker
- name: Storing token for worker
  local_action: copy content={{ token.stdout }} dest={{ token_file }}

#install calico
- name: Install Network Add-on
  command: kubectl apply -f https://docs.projectcalico.org/v3.11/manifests/calico.yaml

#Taint master
- name: Taint master
  command: kubectl taint nodes --all node-role.kubernetes.io/master-