[ANSIBLE] Install cmctl utility
Cert-manager role will also install cmctl utility for cert-manager
resources management.
Change-Id: I4c4d9ecb243c951a190733230f310f4899c9bc23
Issue-ID: OOM-2871
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
diff --git a/ansible/roles/cert-manager/defaults/main.yml b/ansible/roles/cert-manager/defaults/main.yml
index f87c907..aa59c24 100644
--- a/ansible/roles/cert-manager/defaults/main.yml
+++ b/ansible/roles/cert-manager/defaults/main.yml
@@ -6,3 +6,4 @@
helm_values_file: "{{ app_data_path }}/cert_manager.yaml"
helm_values:
installCRDs: true
+cmctl_bin_dir: /usr/local/bin
diff --git a/ansible/roles/cert-manager/molecule/default/prepare.yml b/ansible/roles/cert-manager/molecule/default/prepare.yml
index 8a90616..580e7bf 100644
--- a/ansible/roles/cert-manager/molecule/default/prepare.yml
+++ b/ansible/roles/cert-manager/molecule/default/prepare.yml
@@ -4,6 +4,8 @@
pre_tasks:
- name: Include infrastructure group variables
include_vars: ../../../../group_vars/infrastructure.yml
+ - name: Include test scenario variables
+ include_vars: vars.yml
tasks:
- name: "Include prepare-cert-manager role"
include_role:
diff --git a/ansible/roles/cert-manager/molecule/default/vars.yml b/ansible/roles/cert-manager/molecule/default/vars.yml
new file mode 100644
index 0000000..1233452
--- /dev/null
+++ b/ansible/roles/cert-manager/molecule/default/vars.yml
@@ -0,0 +1,2 @@
+---
+cmctl_version: 1.6.1
diff --git a/ansible/roles/cert-manager/tasks/main.yml b/ansible/roles/cert-manager/tasks/main.yml
index 5b73ded..9bf7fde 100644
--- a/ansible/roles/cert-manager/tasks/main.yml
+++ b/ansible/roles/cert-manager/tasks/main.yml
@@ -20,3 +20,12 @@
wait: True
wait_timeout: "{{ cert_manager.helm_timeout }}"
tags: molecule-notest
+
+- name: Install cmctl
+ unarchive:
+ src: "{{ app_data_path }}/downloads/cmctl-linux-amd64.tar.gz"
+ dest: "{{ cmctl_bin_dir }}"
+ extra_opts:
+ - 'cmctl'
+ remote_src: true
+ mode: 0755
diff --git a/ansible/test/roles/prepare-cert-manager/tasks/main.yml b/ansible/test/roles/prepare-cert-manager/tasks/main.yml
index add4905..1802f1b 100644
--- a/ansible/test/roles/prepare-cert-manager/tasks/main.yml
+++ b/ansible/test/roles/prepare-cert-manager/tasks/main.yml
@@ -9,3 +9,8 @@
get_url:
url: "https://charts.jetstack.io/charts/cert-manager-v{{ cert_manager_version }}.tgz"
dest: "{{ app_data_path }}/downloads"
+
+- name: "Download cmctl binary"
+ get_url:
+ url: "https://github.com/jetstack/cert-manager/releases/download/v{{ cmctl_version }}/cmctl-linux-amd64.tar.gz"
+ dest: "{{ app_data_path }}/downloads"
diff --git a/build/package.py b/build/package.py
index 50e6d8c..f0afcfc 100755
--- a/build/package.py
+++ b/build/package.py
@@ -248,7 +248,8 @@
'**/kubectl',
'**/helm-push_*_linux_amd64.tar.gz',
'**/kube-prometheus-stack-*.tgz',
- '**/cert-manager-*.tgz']
+ '**/cert-manager-*.tgz',
+ '**/cmctl-linux-amd64.tar.gz']
for pattern in bin_pattern_list:
for bin_file in glob.glob(os.path.join('.', pattern), recursive=True):