summaryrefslogtreecommitdiffstats
path: root/ansible/roles/resource-data/tasks/unarchive-nfs-resource.yml
blob: 6087c81c601aa6ad3d44c9c3f36b4eb7450662f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
#
# Expected variables
#   resources_source_host
#   resources_dir
#   resource_source_filename
#   resource_destination_directory
# Output is upload_failed true/false
#
- name: "Upload resource {{ resources_dir }}/{{ resource_source_filename }} to infrastructure servers over nfs"
  block:
    - name: Mount resource dir
      mount:
        path: /tmp/resource_data
        src: "{{ resources_source_host }}:{{ resources_dir }}"
        fstype: nfs
        state: mounted

    - name: "Unarchive resource {{ resources_dir }}/{{ resource_source_filename }} \
             to {{ resource_destination_directory }} dir on infrastructure servers over nfs"
      unarchive:
        src: "/tmp/resource_data/{{ resource_source_filename }}"
        dest: "{{ resource_destination_directory }}"
        remote_src: true
  always:
    - name: Unmount resource dir
      mount:
        path: /tmp/resource_data
        src: "{{ resources_source_host }}:{{ resources_dir }}"
        fstype: nfs
        state: absent