RETIRED, Function as a Service for OpenStack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
1.4 KiB

---
- name: disable swap
shell: swapoff -a
- name: drain the node if needed
shell: kubectl drain {{ ansible_nodename }} --delete-local-data --force --ignore-daemonsets
ignore_errors: True
- name: delete node if needed
shell: kubectl delete node {{ ansible_nodename }}
ignore_errors: True
- name: reset kubeadm setup
shell: kubeadm reset -f
ignore_errors: True
- name: Init master
vars:
extra_opts: "{{ lookup('env', 'EXTRA_KUBEADM_INIT_OPTS') }}"
shell: kubeadm init --pod-network-cidr=192.168.0.0/16 --kubernetes-version=v{{ k8s_version }} {{ extra_opts }}
register: kubeadm_init
- fail:
msg: "kubeadm init command failed."
when: kubeadm_init.stdout.find ("kubeadm join") == -1
- name: Store kubeadm join string
set_fact:
join_str: "{{ kubeadm_init.stdout | regex_search('kubeadm join(.*)$') }}"
- name: Prepare kube config
shell: mkdir -p {{ item }}/.kube && cp -a /etc/kubernetes/admin.conf {{ item }}/.kube/config && chmod 644 {{ item }}/.kube/config
with_items:
- "{{ ansible_env.HOME }}"
- name: Allow pod on master
shell: kubectl taint nodes --all node-role.kubernetes.io/master-
- name: Install Calico
shell: kubectl apply -f {{ item }}
loop:
- https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
- https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml