| 1 | --- |
| 2 | - name: Filesystem Snapshot Module Operations in Unity |
| 3 | hosts: localhost |
| 4 | connection: local |
| 5 | vars: |
| 6 | unispherehost: '10.*.*.*' |
| 7 | validate_certs: false |
| 8 | username: 'user' |
| 9 | password: '**' |
| 10 | snapshot_name: "11_ansible_test_FS_snap" |
| 11 | snapshot_name_1: "11_ansible_test_FS_snap_1" |
| 12 | filesystem_name_1: "11_ansible_test_FS" |
| 13 | nas_server_name_1: "lgla**" |
| 14 | nas_server_name_2: "lgla**" |
| 15 | description: "Created using playbook" |
| 16 | new_description: "Description updated using playbook" |
| 17 | expiry_time: "04/15/2021 2:30" |
| 18 | new_expiry_time: "04/15/2021 5:30" |
| 19 | fs_access_type_1: "Checkpoint" |
| 20 | fs_access_type_2: "Protocol" |
| 21 | |
| 22 | tasks: |
| 23 | - name: Create Filesystem Snapshot |
| 24 | filesystem_snapshot: |
| 25 | unispherehost: "{{ unispherehost }}" |
| 26 | username: "{{ username }}" |
| 27 | password: "{{ password }}" |
| 28 | validate_certs: "{{ validate_certs }}" |
| 29 | snapshot_name: "{{ snapshot_name_1 }}" |
| 30 | filesystem_name: "{{ filesystem_name_1 }}" |
| 31 | nas_server_name: "{{ nas_server_name_1 }}" |
| 32 | description: "{{ description }}" |
| 33 | auto_delete: true |
| 34 | fs_access_type: "{{ fs_access_type_1 }}" |
| 35 | state: "present" |
| 36 | register: result |
| 37 | |
| 38 | - name: Set snapshot_id |
| 39 | ansible.builtin.set_fact: |
| 40 | snapshot_id: "{{ result.dellemc.unity.filesystem_snapshot_details.id }}" |
| 41 | |
| 42 | - name: Create Filesystem Snapshot - Idempotency |
| 43 | filesystem_snapshot: |
| 44 | unispherehost: "{{ unispherehost }}" |
| 45 | username: "{{ username }}" |
| 46 | password: "{{ password }}" |
| 47 | validate_certs: "{{ validate_certs }}" |
| 48 | snapshot_name: "{{ snapshot_name_1 }}" |
| 49 | filesystem_name: "{{ filesystem_name_1 }}" |
| 50 | nas_server_name: "{{ nas_server_name_1 }}" |
| 51 | description: "{{ description }}" |
| 52 | auto_delete: true |
| 53 | fs_access_type: "{{ fs_access_type_1 }}" |
| 54 | state: "present" |
| 55 | |
| 56 | - name: Get Filesystem Snapshot Details using Name |
| 57 | filesystem_snapshot: |
| 58 | unispherehost: "{{ unispherehost }}" |
| 59 | username: "{{ username }}" |
| 60 | password: "{{ password }}" |
| 61 | validate_certs: "{{ validate_certs }}" |
| 62 | snapshot_name: "{{ snapshot_name_1 }}" |
| 63 | state: "present" |
| 64 | |
| 65 | - name: Get Filesystem Snapshot Details using ID |
| 66 | filesystem_snapshot: |
| 67 | unispherehost: "{{ unispherehost }}" |
| 68 | username: "{{ username }}" |
| 69 | password: "{{ password }}" |
| 70 | validate_certs: "{{ validate_certs }}" |
| 71 | snapshot_id: "{{ snapshot_id }}" |
| 72 | state: "present" |
| 73 | |
| 74 | - name: Update Filesystem Snapshot attributes |
| 75 | filesystem_snapshot: |
| 76 | unispherehost: "{{ unispherehost }}" |
| 77 | username: "{{ username }}" |
| 78 | password: "{{ password }}" |
| 79 | validate_certs: "{{ validate_certs }}" |
| 80 | snapshot_name: "{{ snapshot_name_1 }}" |
| 81 | description: "{{ new_description }}" |
| 82 | auto_delete: false |
| 83 | expiry_time: "{{ new_expiry_time }}" |
| 84 | state: "present" |
| 85 | |
| 86 | - name: Get Filesystem Snapshot Details |
| 87 | filesystem_snapshot: |
| 88 | unispherehost: "{{ unispherehost }}" |
| 89 | username: "{{ username }}" |
| 90 | password: "{{ password }}" |
| 91 | validate_certs: "{{ validate_certs }}" |
| 92 | snapshot_name: "{{ snapshot_name_1 }}" |
| 93 | state: "present" |
| 94 | |
| 95 | - name: Delete Filesystem Snapshot using Name |
| 96 | filesystem_snapshot: |
| 97 | unispherehost: "{{ unispherehost }}" |
| 98 | username: "{{ username }}" |
| 99 | password: "{{ password }}" |
| 100 | validate_certs: "{{ validate_certs }}" |
| 101 | snapshot_name: "{{ snapshot_name_1 }}" |
| 102 | state: "absent" |
| 103 | |
| 104 | - name: Delete Filesystem Snapshot using ID- Idempotency |
| 105 | filesystem_snapshot: |
| 106 | unispherehost: "{{ unispherehost }}" |
| 107 | username: "{{ username }}" |
| 108 | password: "{{ password }}" |
| 109 | validate_certs: "{{ validate_certs }}" |
| 110 | snapshot_id: "{{ snapshot_id }}" |
| 111 | state: "absent" |