blob: 41046d81f1d1652d6e3965c76cd858b337bebba7 [file] [log] [blame]
Michal Ptacekf5907202018-12-19 11:54:34 +00001---
Samuli Silvius29886f02019-02-19 16:00:37 +02002- name: Collect source resources
3 block:
4 - name: Check if source dir and files are present
5 stat:
6 path: "{{ item.source }}"
Samuli Silvius178ff1e2019-03-07 11:49:20 +02007 get_checksum: false
Samuli Silvius29886f02019-02-19 16:00:37 +02008 loop:
9 - { source: "{{ resources_dir }}/{{ resources_filename | default('thisdoesnotexists', true) }}",
10 target: "{{ app_data_path }}/{{ resources_filename | default('thisdoesnotexists', true) }}" }
11 - { source: "{{ resources_dir }}/{{ aux_resources_filename | default('thisdoesnotexists', true) }}",
12 target: "{{ aux_data_path }}/{{ aux_resources_filename | default('thisdoesnotexists', true) }}" }
13 register: source_path
14
15 - name: Create initial resources list of dicts
16 set_fact:
17 to_be_uploaded_resources_list: "{{
18 to_be_uploaded_resources_list | default([]) + [
19 {'file': item.item.target | basename,
20 'destination_dir': item.item.target | dirname } ] }}"
21 loop: "{{ source_path.results }}"
22 when: item.stat.exists
23 when: inventory_hostname in groups.resources
24
25- name: "Upload resource files {{ hostvars[groups.resources.0].to_be_uploaded_resources_list }} to infrastructure"
26 include_tasks: upload_resources.yml
27 vars:
28 resources_source_host: "{{ hostvars[groups.resources.0].ansible_host | default(hostvars[groups.resources.0].inventory_hostname) }}"
29 resources_list_of_dicts: "{{ hostvars[groups.resources.0].to_be_uploaded_resources_list }}"
30 when:
31 - inventory_hostname in groups.infrastructure
32 - hostvars[groups.resources.0].to_be_uploaded_resources_list is defined