2015-10-03 20:19:50 +00:00
|
|
|
---
|
|
|
|
- name: Get the node token values
|
|
|
|
slurp:
|
|
|
|
src: "{{ kube_token_dir }}/{{ item }}-{{ inventory_hostname }}.token"
|
|
|
|
with_items:
|
|
|
|
- "system:kubelet"
|
|
|
|
- "system:proxy"
|
|
|
|
register: tokens
|
|
|
|
run_once: true
|
|
|
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
|
|
|
|
|
|
|
- name: Set token facts
|
|
|
|
set_fact:
|
|
|
|
kubelet_token: "{{ tokens.results[0].content|b64decode }}"
|
|
|
|
proxy_token: "{{ tokens.results[1].content|b64decode }}"
|
|
|
|
|
|
|
|
- name: Create kubelet environment vars dir
|
|
|
|
file: path=/etc/systemd/system/kubelet.service.d state=directory
|
|
|
|
|
|
|
|
- name: Write kubelet config file
|
2015-11-20 10:18:37 +00:00
|
|
|
template: src=kubelet.j2 dest=/etc/systemd/system/kubelet.service.d/10-kubelet.conf backup=yes
|
2015-10-03 20:19:50 +00:00
|
|
|
notify:
|
|
|
|
- reload systemd
|
|
|
|
- restart kubelet
|
|
|
|
|
|
|
|
- name: write the kubecfg (auth) file for kubelet
|
2015-11-20 10:18:37 +00:00
|
|
|
template: src=kubelet.kubeconfig.j2 dest={{ kube_config_dir }}/kubelet.kubeconfig backup=yes
|
2015-10-03 20:19:50 +00:00
|
|
|
notify:
|
|
|
|
- restart kubelet
|
|
|
|
|
|
|
|
- name: Create proxy environment vars dir
|
|
|
|
file: path=/etc/systemd/system/kube-proxy.service.d state=directory
|
|
|
|
|
|
|
|
- name: Write proxy config file
|
2015-11-20 10:18:37 +00:00
|
|
|
template: src=proxy.j2 dest=/etc/systemd/system/kube-proxy.service.d/10-proxy-cluster.conf backup=yes
|
2015-10-03 20:19:50 +00:00
|
|
|
notify:
|
|
|
|
- reload systemd
|
|
|
|
- restart proxy
|
|
|
|
|
|
|
|
- name: write the kubecfg (auth) file for kube-proxy
|
2015-11-20 10:18:37 +00:00
|
|
|
template: src=proxy.kubeconfig.j2 dest={{ kube_config_dir }}/proxy.kubeconfig backup=yes
|
2015-10-03 20:19:50 +00:00
|
|
|
notify:
|
|
|
|
- restart proxy
|
|
|
|
|
|
|
|
- name: Enable kubelet
|
|
|
|
service:
|
|
|
|
name: kubelet
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
|
|
|
|
- name: Enable proxy
|
|
|
|
service:
|
|
|
|
name: kube-proxy
|
|
|
|
enabled: yes
|
|
|
|
state: started
|