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