diff options
author | Milan Verespej <m.verespej@partner.samsung.com> | 2019-02-08 15:30:39 +0100 |
---|---|---|
committer | Michal Ptacek <m.ptacek@partner.samsung.com> | 2019-02-11 18:44:48 +0000 |
commit | 5f5aa01c0f757ff3a9eb55eb978b98e45f23a079 (patch) | |
tree | 24a88089800cef02714df1a8929efe842a964adb /ansible | |
parent | 55d8a890827a6b86937aa0d5181bb0b3bad70a8d (diff) |
Change helm plugin install to copy module
Since helm plugin install command is not the most suitable
for Ansible and it basically just creates link to plugin original
location this change is using Ansible's copy module instead.
Plugin is copied from install server because copy module doesn't
support recursive directory copying with remote_src option.
Issue-ID: OOM-1638
Change-Id: I9e9dcd8d33f8917296f576c2b34c0c576c9c126c
Signed-off-by: Milan Verespej <m.verespej@partner.samsung.com>
Diffstat (limited to 'ansible')
-rwxr-xr-x | ansible/group_vars/all.yml | 2 | ||||
-rw-r--r-- | ansible/roles/application-install/tasks/install.yml | 2 | ||||
-rw-r--r-- | ansible/roles/application-install/tasks/pre-install.yml | 36 |
3 files changed, 23 insertions, 17 deletions
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 0a73b637..e70a837b 100755 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -114,7 +114,7 @@ app_helm_build_targets: # Directory with helm plugins # It's an optional parameter used e.g. in OOM Casablanca -# app_helm_plugins_directory: "{{ app_helm_charts_infra_directory}}/kubernetes/helm/plugins/" +# app_helm_plugins_directory: "{{ app_helm_charts_install_directory}}/kubernetes/helm/plugins/" app_helm_plugins_directory: # Helm release name (visible in POD names) used by Helm diff --git a/ansible/roles/application-install/tasks/install.yml b/ansible/roles/application-install/tasks/install.yml index ab17aba4..5246bf2f 100644 --- a/ansible/roles/application-install/tasks/install.yml +++ b/ansible/roles/application-install/tasks/install.yml @@ -55,7 +55,7 @@ - name: Check for deploy plugin presence stat: - path: '~/.helm/plugins/deploy/deploy.sh' + path: '{{ helm_home_dir.stdout }}/plugins/deploy/deploy.sh' register: deploy_plugin_presence - name: "Helm Install application {{ app_name }}" diff --git a/ansible/roles/application-install/tasks/pre-install.yml b/ansible/roles/application-install/tasks/pre-install.yml index 3d63cb55..f87ade33 100644 --- a/ansible/roles/application-install/tasks/pre-install.yml +++ b/ansible/roles/application-install/tasks/pre-install.yml @@ -20,21 +20,27 @@ - name: Install helm plugins if needed block: - - name: Ensure that dir for helm plugins exists - file: - path: "~/.helm/plugins" - state: directory - mode: 0755 - - name: Register all plugins to be inserted by dir names - find: - paths: "{{ app_helm_plugins_directory }}" - file_type: "directory" - register: list_of_plugins - - name: Install all helm plugins from {{ app_helm_plugins_directory }} dir - command: "{{ helm_bin_dir }}/helm plugin install {{ item.path }}" - with_items: "{{ list_of_plugins.files }}" - register: helm_plugin_install_result - failed_when: "helm_plugin_install_result.rc > 0 and helm_plugin_install_result.stderr != 'Error: plugin already exists'" + - name: Get helm dir + command: "{{ helm_bin_dir }}/helm home" + register: helm_home_dir + - name: Ensure that dir for helm plugins exists + file: + path: "{{ helm_home_dir.stdout }}/plugins" + state: directory + mode: 0755 + - name: Register all plugins to be inserted by dir names + find: + paths: "{{ app_helm_plugins_directory }}" + file_type: "directory" + register: list_of_plugins + delegate_to: localhost + - name: Install all helm plugins from {{ app_helm_plugins_directory }} dir + copy: + src: "{{ item.path }}" + dest: "{{ helm_home_dir.stdout }}"/plugins" + directory_mode: yes + mode: 0755 + with_items: "{{ list_of_plugins.files }}" become: true when: app_helm_plugins_directory is defined and app_helm_plugins_directory is not none |