summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Ospalý <p.ospaly@partner.samsung.com>2018-12-19 14:49:29 +0100
committerPetr Ospalý <p.ospaly@partner.samsung.com>2018-12-19 14:49:29 +0100
commita00ff0c3be6338eecd99ee322a74fb37872c0d17 (patch)
treeca522ee5e698810807126ad09d067f78e2bcc81b
parentb8f3d733e03045b0484acee786e3e095cc1b4d92 (diff)
Add the playbook for unpacking the resources
Change-Id: I2b0190dc25f341fafa3b1cbf978c764c675280d4 Issue-ID: OOM-1551 Signed-off-by: Petr Ospalý <p.ospaly@partner.samsung.com>
-rw-r--r--ansible/upload_resources.yml49
1 files changed, 49 insertions, 0 deletions
diff --git a/ansible/upload_resources.yml b/ansible/upload_resources.yml
new file mode 100644
index 00000000..68010eb1
--- /dev/null
+++ b/ansible/upload_resources.yml
@@ -0,0 +1,49 @@
+---
+- name: Check for presence of auxiliary resources tar file
+ hosts: resources[0]
+ tasks:
+ - name: Store auxiliary resources tar file info into variable
+ stat:
+ path: "{{ hostvars[groups.resources.0].resources_dir }}/{{ hostvars[groups.resources.0].aux_resources_filename }}"
+ register: aux_file_presence
+
+- name: Check infrastructure server for presence of resources and requirements
+ hosts: infrastructure
+ tasks:
+ - name: Check if nfs-utils is installed
+ yum:
+ list: nfs-utils
+ register: nfs_utils_check
+
+ - name: Check if the resources are already unpacked
+ stat:
+ path: "{{ app_data_path }}"
+ register: resources_data_check
+
+ - name: Check if the auxilliary resources are already unpacked
+ stat:
+ path: "{{ aux_data_path }}"
+ register: aux_resources_data_check
+ when: aux_data_path is defined and aux_data_path is not none
+
+- name: Ensure the existence of data directory/ies on infrastructure server
+ hosts: infrastructure
+ tasks:
+ - name: Create data directory
+ file:
+ path: "{{ app_data_path }}"
+ state: directory
+
+ - name: Create auxiliary data directory
+ file:
+ path: "{{ aux_data_path }}"
+ state: directory
+ when: aux_data_path is defined and aux_data_path is not none
+
+- name: Upload resources to infrastructure server
+ hosts: infrastructure
+ roles:
+ # use nfs or ssh and unpack resources into data directory/ies
+ - role: resource-data
+ vars:
+ transport: "{{ 'nfs' if resources_on_nfs and (nfs_utils_check.results|selectattr('yumstate', 'match', 'installed')|list|length != 0) else 'ssh' }}"