-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathworker.yaml
47 lines (38 loc) · 1.16 KB
/
worker.yaml
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
---
- hosts: all
become: true
gather_facts: yes
tasks:
- name: Check war files in release
local_action: stat path="/vagrant/.ssh/id_rsa.pub"
register: key_file
- name: Set authorized key taken from file
authorized_key:
user: vagrant
state: present
key: "{{ lookup('file', '/vagrant/.ssh/id_rsa.pub') }}"
when: key_file.stat.exists == True
- name: Reset existing cluster components if any
command: kubeadm reset -f
- name: Remove default IP route for service network
command: "ip route flush 10.96.0.0/16"
- name: Recursively remove directory
ansible.builtin.file:
path: "{{ item }}"
state: absent
with_items:
- /root/.kube
- /etc/cni/net.d
- /etc/kubernetes
- /var/lib/etcd
- /var/lib/kubelet
- /var/run/kubernetes
- /var/lib/cni
- /opt/cni
- name: Iptables flush filter
ansible.builtin.iptables:
flush: yes
- name: Configure default IP route for service network
command: "ip route add 10.96.0.0/16 dev eth1 src {{ ansible_eth1.ipv4.address }}"
- name: Run the join command
shell: $(cat /etc/.vagrantdata/kubeadm-join)