2015-10-03 20:19:50 +00:00
|
|
|
---
|
2016-01-19 13:08:57 +00:00
|
|
|
- name: Secrets | certs | make sure the certificate directory exits
|
2015-10-03 20:19:50 +00:00
|
|
|
file:
|
|
|
|
path={{ kube_cert_dir }}
|
|
|
|
state=directory
|
|
|
|
mode=o-rwx
|
|
|
|
group={{ kube_cert_group }}
|
|
|
|
|
2016-01-19 13:08:57 +00:00
|
|
|
- name: Secrets | tokens | make sure the tokens directory exits
|
2015-10-03 20:19:50 +00:00
|
|
|
file:
|
|
|
|
path={{ kube_token_dir }}
|
|
|
|
state=directory
|
|
|
|
mode=o-rwx
|
|
|
|
group={{ kube_cert_group }}
|
|
|
|
|
|
|
|
- include: gen_certs.yml
|
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|
|
|
|
|
2015-12-11 10:32:13 +00:00
|
|
|
# Sync certs between nodes
|
2016-01-19 13:08:57 +00:00
|
|
|
- name: Secrets | create user
|
|
|
|
user:
|
2015-12-11 10:32:13 +00:00
|
|
|
name: '{{ansible_user_id}}'
|
|
|
|
generate_ssh_key: yes
|
|
|
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
|
|
|
run_once: yes
|
2015-10-03 20:19:50 +00:00
|
|
|
|
2016-01-19 13:08:57 +00:00
|
|
|
- name: Secrets | 'get ssh keypair'
|
2015-12-11 10:32:13 +00:00
|
|
|
slurp: path=~/.ssh/id_rsa.pub
|
|
|
|
register: public_key
|
|
|
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
2015-10-03 20:19:50 +00:00
|
|
|
|
2016-01-19 13:08:57 +00:00
|
|
|
- name: Secrets | 'setup keypair on nodes'
|
2015-12-11 10:32:13 +00:00
|
|
|
authorized_key:
|
|
|
|
user: '{{ansible_user_id}}'
|
|
|
|
key: "{{public_key.content|b64decode }}"
|
2015-11-20 13:04:13 +00:00
|
|
|
|
2016-01-19 13:08:57 +00:00
|
|
|
- name: Secrets | synchronize certificates for nodes
|
2015-12-11 10:32:13 +00:00
|
|
|
synchronize:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ kube_cert_dir }}"
|
|
|
|
recursive: yes
|
|
|
|
delete: yes
|
|
|
|
rsync_opts: [ '--one-file-system']
|
2016-01-05 14:33:23 +00:00
|
|
|
set_remote_user: false
|
2015-12-11 10:32:13 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ kube_cert_dir}}/ca.pem"
|
|
|
|
- "{{ kube_cert_dir}}/node.pem"
|
|
|
|
- "{{ kube_cert_dir}}/node-key.pem"
|
|
|
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
2015-12-21 13:24:57 +00:00
|
|
|
when: inventory_hostname not in "{{ groups['kube-master'] }}"
|