2 - name: Collect source resources
4 - name: Check if source dir and files are present
6 path: "{{ item.source }}"
8 - { source: "{{ resources_dir }}/{{ resources_filename | default('thisdoesnotexists', true) }}",
9 target: "{{ app_data_path }}/{{ resources_filename | default('thisdoesnotexists', true) }}" }
10 - { source: "{{ resources_dir }}/{{ aux_resources_filename | default('thisdoesnotexists', true) }}",
11 target: "{{ aux_data_path }}/{{ aux_resources_filename | default('thisdoesnotexists', true) }}" }
14 - name: Create initial resources list of dicts
16 to_be_uploaded_resources_list: "{{
17 to_be_uploaded_resources_list | default([]) + [
18 {'file': item.item.target | basename,
19 'destination_dir': item.item.target | dirname } ] }}"
20 loop: "{{ source_path.results }}"
21 when: item.stat.exists
22 when: inventory_hostname in groups.resources
24 - name: "Upload resource files {{ hostvars[groups.resources.0].to_be_uploaded_resources_list }} to infrastructure"
25 include_tasks: upload_resources.yml
27 resources_source_host: "{{ hostvars[groups.resources.0].ansible_host | default(hostvars[groups.resources.0].inventory_hostname) }}"
28 resources_list_of_dicts: "{{ hostvars[groups.resources.0].to_be_uploaded_resources_list }}"
30 - inventory_hostname in groups.infrastructure
31 - hostvars[groups.resources.0].to_be_uploaded_resources_list is defined