summaryrefslogtreecommitdiffstats
path: root/ansible/roles/rke/tasks/rke_config.yml
diff options
context:
space:
mode:
authorPetr Ospalý <p.ospaly@partner.samsung.com>2019-04-20 00:53:01 +0200
committerPetr Ospalý <p.ospaly@partner.samsung.com>2019-05-17 08:08:11 +0000
commitfe49ee9006e9396c79f90365b9e814ee70c9fcee (patch)
tree5c324db6678a5429d34061160872da13addaf15d /ansible/roles/rke/tasks/rke_config.yml
parent280ef8da90cf2bab9ddf7b3df78b12a3b2cf6040 (diff)
Add support for RKE kubernetes implementation
Added a new playbook rke.yml and role rke which uses rancher RKE: https://github.com/rancher/rke It's an implementation of the kubernetes from rancher.com folks and it is an alternative to the official kubernetes tool: kubeadm. NOTE: Rancher has a notion of a 'control plane' which cannot run with etcd on all nodes in a multi-node setup. Control-plane node is the first kubernetes node from the inventory (as of now). Change-Id: I0bf669442a5183efa20d44fb1cac823e7ce54348 Issue-ID: OOM-1778 Signed-off-by: Petr Ospalý <p.ospaly@partner.samsung.com> Signed-off-by: Michal Zegan <m.zegan@samsung.com>
Diffstat (limited to 'ansible/roles/rke/tasks/rke_config.yml')
-rw-r--r--ansible/roles/rke/tasks/rke_config.yml46
1 files changed, 46 insertions, 0 deletions
diff --git a/ansible/roles/rke/tasks/rke_config.yml b/ansible/roles/rke/tasks/rke_config.yml
new file mode 100644
index 00000000..49503192
--- /dev/null
+++ b/ansible/roles/rke/tasks/rke_config.yml
@@ -0,0 +1,46 @@
+---
+- 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"
+
+- name: Install rke cli tool
+ copy:
+ src: "{{ app_data_path }}/downloads/{{ rke_binary }}"
+ dest: "{{ rke_bin_dir }}/rke"
+ remote_src: true
+ mode: 0755