2016-01-22 13:25:33 +00:00
|
|
|
---
|
2016-01-30 15:04:47 +00:00
|
|
|
- name: tokens | copy the token gen script
|
|
|
|
copy:
|
|
|
|
src=kube-gen-token.sh
|
|
|
|
dest={{ kube_script_dir }}
|
|
|
|
mode=u+x
|
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|
|
|
|
|
2016-01-22 13:25:33 +00:00
|
|
|
- name: tokens | generate tokens for master components
|
|
|
|
command: "{{ kube_script_dir }}/kube-gen-token.sh {{ item[0] }}-{{ item[1] }}"
|
|
|
|
environment:
|
|
|
|
TOKEN_DIR: "{{ kube_token_dir }}"
|
|
|
|
with_nested:
|
|
|
|
- [ "system:kubectl" ]
|
|
|
|
- "{{ groups['kube-master'] }}"
|
|
|
|
register: gentoken_master
|
|
|
|
changed_when: "'Added' in gentoken_master.stdout"
|
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|
|
|
|
notify: restart kube-apiserver
|
|
|
|
|
|
|
|
- name: tokens | generate tokens for node components
|
|
|
|
command: "{{ kube_script_dir }}/kube-gen-token.sh {{ item[0] }}-{{ item[1] }}"
|
|
|
|
environment:
|
|
|
|
TOKEN_DIR: "{{ kube_token_dir }}"
|
|
|
|
with_nested:
|
|
|
|
- [ 'system:kubelet' ]
|
|
|
|
- "{{ groups['kube-node'] }}"
|
|
|
|
register: gentoken_node
|
|
|
|
changed_when: "'Added' in gentoken_node.stdout"
|
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|
|
|
|
notify: restart kube-apiserver
|