blob: 9dc0d8c699b2c40051158d92b5a5118a945e7216 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
---
- name: "Ensure the .ssh directory exists"
file:
path: "{{ ansible_env.HOME }}/.ssh"
mode: 0700
state: directory
- name: Add kubernetes nodes host keys to known_hosts file
known_hosts:
name: "{{ hostvars[item].cluster_ip }}"
key: "{{ hostvars[item].cluster_ip }} ssh-rsa {{ hostvars[item].ansible_ssh_host_key_rsa_public }}"
hash_host: true
state: present
loop: "{{ groups['kubernetes'] }}"
- name: "Ensure {{ cluster_config_dir }} is present"
file:
path: "{{ cluster_config_dir }}"
state: directory
mode: 0755
- name: Generate cluster wide ssh key pair
command: "ssh-keygen -q -b 4096 -t rsa -N '' -f {{ cluster_config_dir }}/cluster_key"
args:
creates: "{{ cluster_config_dir }}/cluster_key"
- name: Get ssh public key
slurp:
src: "{{ cluster_config_dir }}/cluster_key.pub"
register: cluster_public_key_out
- name: Decode ssh public key
set_fact:
cluster_public_key: "{{ cluster_public_key_out.content | b64decode }}"
- name: Prepare rke cluster.yml
template:
src: cluster.yml.j2
dest: "{{ cluster_config_dir }}/cluster.yml"
register: cluster_yml
- name: Prepare rke addon manifest (dashboard)
template:
src: kubernetes-dashboard.yaml.j2
dest: "{{ cluster_config_dir }}/kubernetes-dashboard.yml"
- name: Prepare rke addon manifest (dashboard user)
template:
src: k8s-dashboard-user.yml.j2
dest: "{{ cluster_config_dir }}/k8s-dashboard-user.yml"
- name: Install rke cli tool
copy:
src: "{{ app_data_path }}/downloads/{{ rke_binary }}"
dest: "{{ rke_bin_dir }}/rke"
remote_src: true
mode: 0755
|