summaryrefslogtreecommitdiffstats
path: root/ansible_collections/dellemc/unity/playbooks/modules/filesystem_snapshot.yml
blob: 16ce88db2f4cb389bdb20996baf76282d0e68bde (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
- name: Filesystem Snapshot Module Operations in Unity
  hosts: localhost
  connection: local
  vars:
    unispherehost: '10.*.*.*'
    validate_certs: false
    username: 'user'
    password: '**'
    snapshot_name: "11_ansible_test_FS_snap"
    snapshot_name_1: "11_ansible_test_FS_snap_1"
    filesystem_name_1: "11_ansible_test_FS"
    nas_server_name_1: "lgla**"
    nas_server_name_2: "lgla**"
    description: "Created using playbook"
    new_description: "Description updated using playbook"
    expiry_time: "04/15/2021 2:30"
    new_expiry_time: "04/15/2021 5:30"
    fs_access_type_1: "Checkpoint"
    fs_access_type_2: "Protocol"

  tasks:
    - name: Create Filesystem Snapshot
      dellemc.unity.filesystem_snapshot:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_name: "{{ snapshot_name_1 }}"
        filesystem_name: "{{ filesystem_name_1 }}"
        nas_server_name: "{{ nas_server_name_1 }}"
        description: "{{ description }}"
        auto_delete: true
        fs_access_type: "{{ fs_access_type_1 }}"
        state: "present"
      register: result

    - name: Set snapshot_id
      ansible.builtin.set_fact:
        snapshot_id: "{{ result.dellemc.unity.filesystem_snapshot_details.id }}"

    - name: Create Filesystem Snapshot - Idempotency
      dellemc.unity.filesystem_snapshot:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_name: "{{ snapshot_name_1 }}"
        filesystem_name: "{{ filesystem_name_1 }}"
        nas_server_name: "{{ nas_server_name_1 }}"
        description: "{{ description }}"
        auto_delete: true
        fs_access_type: "{{ fs_access_type_1 }}"
        state: "present"

    - name: Get Filesystem Snapshot Details using Name
      dellemc.unity.filesystem_snapshot:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_name: "{{ snapshot_name_1 }}"
        state: "present"

    - name: Get Filesystem Snapshot Details using ID
      dellemc.unity.filesystem_snapshot:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_id: "{{ snapshot_id }}"
        state: "present"

    - name: Update Filesystem Snapshot attributes
      dellemc.unity.filesystem_snapshot:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_name: "{{ snapshot_name_1 }}"
        description: "{{ new_description }}"
        auto_delete: false
        expiry_time: "{{ new_expiry_time }}"
        state: "present"

    - name: Get Filesystem Snapshot Details
      dellemc.unity.filesystem_snapshot:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_name: "{{ snapshot_name_1 }}"
        state: "present"

    - name: Delete Filesystem Snapshot using Name
      dellemc.unity.filesystem_snapshot:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_name: "{{ snapshot_name_1 }}"
        state: "absent"

    - name: Delete Filesystem Snapshot using ID- Idempotency
      dellemc.unity.filesystem_snapshot:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_id: "{{ snapshot_id }}"
        state: "absent"