summaryrefslogtreecommitdiffstats
path: root/ansible/test
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/test')
-rw-r--r--ansible/test/play-rke/molecule/default/prepare.yml1
-rw-r--r--ansible/test/play-rke/molecule/default/vars.yml1
-rw-r--r--ansible/test/roles/prepare-rke/tasks/all.yml3
-rw-r--r--ansible/test/roles/prepare-rke/tasks/infra.yml13
-rw-r--r--ansible/test/roles/prepare-rke/templates/rke.j214
5 files changed, 30 insertions, 2 deletions
diff --git a/ansible/test/play-rke/molecule/default/prepare.yml b/ansible/test/play-rke/molecule/default/prepare.yml
index 9f254c00..6d810052 100644
--- a/ansible/test/play-rke/molecule/default/prepare.yml
+++ b/ansible/test/play-rke/molecule/default/prepare.yml
@@ -2,7 +2,6 @@
- name: Prepare for all
hosts: all
roles:
- - prepare-docker-dind
- role: prepare-rke
vars:
mode: all
diff --git a/ansible/test/play-rke/molecule/default/vars.yml b/ansible/test/play-rke/molecule/default/vars.yml
index fa5b60e3..739dc955 100644
--- a/ansible/test/play-rke/molecule/default/vars.yml
+++ b/ansible/test/play-rke/molecule/default/vars.yml
@@ -1,3 +1,4 @@
---
app_name: moleculeapp
app_data_path: "/opt/{{ app_name }}"
+cluster_config_dir: "/opt/{{ app_name }}/cluster"
diff --git a/ansible/test/roles/prepare-rke/tasks/all.yml b/ansible/test/roles/prepare-rke/tasks/all.yml
index d4b67c1f..7f876ff3 100644
--- a/ansible/test/roles/prepare-rke/tasks/all.yml
+++ b/ansible/test/roles/prepare-rke/tasks/all.yml
@@ -4,3 +4,6 @@
name: systemd-user-sessions
state: started
+- name: "Add docker group"
+ group:
+ name: docker
diff --git a/ansible/test/roles/prepare-rke/tasks/infra.yml b/ansible/test/roles/prepare-rke/tasks/infra.yml
index 8aa93ca7..0a0b9273 100644
--- a/ansible/test/roles/prepare-rke/tasks/infra.yml
+++ b/ansible/test/roles/prepare-rke/tasks/infra.yml
@@ -4,11 +4,22 @@
path: "{{ app_data_path }}/downloads"
state: directory
+- name: "Create rke binary wrapper"
+ template:
+ src: rke.j2
+ dest: "{{ app_data_path }}/downloads/rke_linux-amd64"
+ mode: 0755
+
- name: "Install rke-{{ rke_version }}"
- command: "curl --connect-timeout 10 -L https://github.com/rancher/rke/releases/download/v{{ rke_version }}/rke_linux-amd64 -o {{ app_data_path }}/downloads/rke_linux-amd64"
+ command: "curl --connect-timeout 10 -L https://github.com/rancher/rke/releases/download/v{{ rke_version }}/rke_linux-amd64 -o {{ app_data_path }}/downloads/rke_linux-amd64_real"
register: result
retries: 10
delay: 1
until: not result.failed
args:
warn: false
+
+- name: "Ensure downloaded rke binary has correct file mode"
+ file:
+ path: "{{ app_data_path }}/downloads/rke_linux-amd64_real"
+ mode: 0755
diff --git a/ansible/test/roles/prepare-rke/templates/rke.j2 b/ansible/test/roles/prepare-rke/templates/rke.j2
new file mode 100644
index 00000000..ea1267ea
--- /dev/null
+++ b/ansible/test/roles/prepare-rke/templates/rke.j2
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+if [[ $@ =~ 'up' ]];
+then
+ # If the operation is 'rke up' then simulate rke up operation
+ echo $@
+ touch {{ cluster_config_dir }}/kube_config_cluster.yml
+elif [[ $@ =~ 'version' ]];
+then
+ {{ app_data_path }}/downloads/rke_linux-amd64_real version
+ exit 0
+else
+ {{ app_data_path }}/downloads/rke_linux-amd64_real $@
+fi