Re-factored resources upload into role
Whole functionality of resource files upload is
implemented in resource-data role instead of
playbook level tasks.
This will make roles easier to test
and make it easier to implement other OS support later.
Issue-ID: OOM-1654
Change-Id: I3d3da9381b0e804f511ee854c41554b924d18883
Signed-off-by: Samuli Silvius <s.silvius@partner.samsung.com>
diff --git a/ansible/roles/resource-data/tasks/upload_resources.yml b/ansible/roles/resource-data/tasks/upload_resources.yml
new file mode 100644
index 0000000..571bc7d
--- /dev/null
+++ b/ansible/roles/resource-data/tasks/upload_resources.yml
@@ -0,0 +1,15 @@
+---
+- name: Query package facts to check nfs-utils existence
+ package_facts:
+ manager: auto
+
+- name: Set transport fact to nfs or ssh
+ set_fact:
+ transport: "{{ 'nfs' if resources_on_nfs and 'nfs-utils' in ansible_facts.packages else 'ssh' }}"
+
+- name: "Upload resources to infrastructure servers over {{ transport }}"
+ include_tasks: unarchive-resource.yml
+ vars:
+ resource_source_filename: "{{ item.file }}"
+ resource_destination_directory: "{{ item.destination_dir }}"
+ loop: "{{ resources_list_of_dicts }}"