blob: 68010eb14f21e16f1354097934a84d9a95604245 [file] [log] [blame]
Petr Ospalýa00ff0c2018-12-19 14:49:29 +01001---
2- name: Check for presence of auxiliary resources tar file
3 hosts: resources[0]
4 tasks:
5 - name: Store auxiliary resources tar file info into variable
6 stat:
7 path: "{{ hostvars[groups.resources.0].resources_dir }}/{{ hostvars[groups.resources.0].aux_resources_filename }}"
8 register: aux_file_presence
9
10- name: Check infrastructure server for presence of resources and requirements
11 hosts: infrastructure
12 tasks:
13 - name: Check if nfs-utils is installed
14 yum:
15 list: nfs-utils
16 register: nfs_utils_check
17
18 - name: Check if the resources are already unpacked
19 stat:
20 path: "{{ app_data_path }}"
21 register: resources_data_check
22
23 - name: Check if the auxilliary resources are already unpacked
24 stat:
25 path: "{{ aux_data_path }}"
26 register: aux_resources_data_check
27 when: aux_data_path is defined and aux_data_path is not none
28
29- name: Ensure the existence of data directory/ies on infrastructure server
30 hosts: infrastructure
31 tasks:
32 - name: Create data directory
33 file:
34 path: "{{ app_data_path }}"
35 state: directory
36
37 - name: Create auxiliary data directory
38 file:
39 path: "{{ aux_data_path }}"
40 state: directory
41 when: aux_data_path is defined and aux_data_path is not none
42
43- name: Upload resources to infrastructure server
44 hosts: infrastructure
45 roles:
46 # use nfs or ssh and unpack resources into data directory/ies
47 - role: resource-data
48 vars:
49 transport: "{{ 'nfs' if resources_on_nfs and (nfs_utils_check.results|selectattr('yumstate', 'match', 'installed')|list|length != 0) else 'ssh' }}"