Commit 52bcc792 authored by eric pellegrini's avatar eric pellegrini

added playbook and associated roles for setting the cluster

parent 204e0630
- hosts: master
remote_user: root
no_proxy: "{{ configured_no_proxy }}"
NO_PROXY: "{{ configured_no_proxy }}"
- role: roles/initialize-control-plane
- role: roles/initialize-cluster
become_user: kubernetes-admin
become: yes
--- ---
# tasks file for initialize-cluster # tasks file for create-admin
- name: (re)initialize the kubernetes cluster - name: remove previous kubernetes configuration file
command: kubeadm init --node-name={{ master_name }} --pod-network-cidr={{ pod_network_cidr }} file:
path: "{{ kubernetes_admin_home }}/.kube"
state: absent
- name: create ~/.kube file
path: "{{ kubernetes_admin_home }}/.kube"
state: directory
- name: copy default kubernetes configuration file to ~/.kube
src: /etc/kubernetes/admin.conf
dest: "{{ kubernetes_admin_home }}/.kube/config"
remote_src: yes
become: yes
- name: change ownership of ~/.kube/config
path: "{{ kubernetes_admin_home }}/.kube/config"
owner: kubernetes-admin
group: kubernetes
become: yes
- name: install cni provider for pod network
command: kubectl apply -f{{cni_provider}}/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-{{cni_provider}}.yml
- name: generate the kubernetes join command
command: kubeadm token create --print-join-command
register: kub_join_command
- name: copy join command to local file
local_action: copy content="{{ kub_join_command.stdout }}" dest="~/"
# tasks file for initialize-cluster
- name: (re)initialize the kubernetes cluster
command: kubeadm init --node-name={{ inventory_hostname }} --pod-network-cidr={{ pod_network_cidr }}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment