c12s-kubespray/roles/kubernetes/master/tasks/config.yml

89 lines
2.6 KiB
YAML
Raw Normal View History

2015-10-03 20:19:50 +00:00
---
- name: get the node token values from token files
slurp:
src: "{{ kube_token_dir }}/{{ item }}-{{ inventory_hostname }}.token"
with_items:
- "system:controller_manager"
- "system:scheduler"
- "system:kubectl"
- "system:proxy"
register: tokens
delegate_to: "{{ groups['kube-master'][0] }}"
- name: Set token facts
set_fact:
controller_manager_token: "{{ tokens.results[0].content|b64decode }}"
scheduler_token: "{{ tokens.results[1].content|b64decode }}"
kubectl_token: "{{ tokens.results[2].content|b64decode }}"
proxy_token: "{{ tokens.results[3].content|b64decode }}"
- name: write the config files for api server
2015-11-20 10:18:37 +00:00
template: src=apiserver.j2 dest={{ kube_config_dir }}/apiserver backup=yes
2015-10-03 20:19:50 +00:00
notify:
- restart apiserver
2015-10-03 20:19:50 +00:00
- name: write config file for controller-manager
2015-11-20 10:18:37 +00:00
template: src=controller-manager.j2 dest={{ kube_config_dir }}/controller-manager backup=yes
2015-10-03 20:19:50 +00:00
notify:
- restart controller-manager
- name: write the kubecfg (auth) file for controller-manager
2015-11-20 10:18:37 +00:00
template: src=controller-manager.kubeconfig.j2 dest={{ kube_config_dir }}/controller-manager.kubeconfig backup=yes
2015-10-03 20:19:50 +00:00
notify:
- restart controller-manager
- name: write the config file for scheduler
2015-11-20 10:18:37 +00:00
template: src=scheduler.j2 dest={{ kube_config_dir }}/scheduler backup=yes
2015-10-03 20:19:50 +00:00
notify:
- restart scheduler
- name: write the kubecfg (auth) file for scheduler
2015-11-20 10:18:37 +00:00
template: src=scheduler.kubeconfig.j2 dest={{ kube_config_dir }}/scheduler.kubeconfig backup=yes
2015-10-03 20:19:50 +00:00
notify:
- restart scheduler
- name: write the kubecfg (auth) file for kubectl
2015-11-20 10:18:37 +00:00
template: src=kubectl.kubeconfig.j2 dest={{ kube_config_dir }}/kubectl.kubeconfig backup=yes
2015-10-03 20:19:50 +00:00
- name: write the config files for proxy
2015-11-20 10:18:37 +00:00
template: src=proxy.j2 dest={{ kube_config_dir }}/proxy backup=yes
2015-10-03 20:19:50 +00:00
notify:
- restart proxy
2015-10-03 20:19:50 +00:00
- name: write the kubecfg (auth) file for 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
- name: populate users for basic auth in API
lineinfile:
dest: "{{ kube_users_dir }}/known_users.csv"
create: yes
line: '{{ item.value.pass }},{{ item.key }},{{ item.value.role }}'
2015-11-20 10:18:37 +00:00
backup: yes
2015-10-03 20:19:50 +00:00
with_dict: "{{ kube_users }}"
notify:
- restart apiserver
- name: Enable controller-manager
service:
name: kube-controller-manager
enabled: yes
state: started
- name: Enable scheduler
service:
name: kube-scheduler
enabled: yes
state: started
- name: Enable kube-proxy
service:
name: kube-proxy
enabled: yes
state: started
- name: Enable apiserver
service:
name: kube-apiserver
enabled: yes
state: started