summaryrefslogtreecommitdiffstats
path: root/ansible/test/roles
diff options
context:
space:
mode:
authorSamuli Silvius <s.silvius@partner.samsung.com>2019-06-05 14:57:23 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-05 14:57:23 +0000
commitc07a4d7fc0f25e9cfea300cbce8fc624ad922384 (patch)
tree3961390d44f0f41e3e569626894e2f9290fae1b4 /ansible/test/roles
parenta2001d11fe5a880f6ad2aa19989c75f2eb1e66e9 (diff)
parent551e2682c6c473bdb96aa59ddc18612a436e4b46 (diff)
Merge "Add prepare-kubectl role"
Diffstat (limited to 'ansible/test/roles')
-rw-r--r--ansible/test/roles/prepare-kubectl/defaults/main.yml7
-rw-r--r--ansible/test/roles/prepare-kubectl/tasks/main.yml14
2 files changed, 21 insertions, 0 deletions
diff --git a/ansible/test/roles/prepare-kubectl/defaults/main.yml b/ansible/test/roles/prepare-kubectl/defaults/main.yml
new file mode 100644
index 00000000..d4e8ef94
--- /dev/null
+++ b/ansible/test/roles/prepare-kubectl/defaults/main.yml
@@ -0,0 +1,7 @@
+---
+# Set to false to download kubectl in preparation for kubectl role that
+# needs to install it, set to true to immediately install (needed for
+# cases where it is used by verification tests of other roles).
+kubectl_install: false
+# Kubectl version.
+kubectl_version: 1.13.5
diff --git a/ansible/test/roles/prepare-kubectl/tasks/main.yml b/ansible/test/roles/prepare-kubectl/tasks/main.yml
new file mode 100644
index 00000000..b5631850
--- /dev/null
+++ b/ansible/test/roles/prepare-kubectl/tasks/main.yml
@@ -0,0 +1,14 @@
+---
+- name: "Ensure {{ app_data_path }} exists"
+ file:
+ path: "{{ app_data_path }}/downloads"
+ state: directory
+ when: not kubectl_install
+
+- name: "Install kubectl-{{ kubectl_version }}"
+ get_url:
+ url: "https://storage.googleapis.com/kubernetes-release/release/v{{ kubectl_version }}/bin/linux/amd64/kubectl"
+ dest: "{{ '/usr/local/bin/kubectl' if kubectl_install else app_data_path+'/downloads/kubectl' }}"
+ # This mode conditional allows checking if kubectl role, when installing kubectl, correctly
+ # adds executable bit (bonus).
+ mode: "{{ 0755 if kubectl_install else omit }}"