summaryrefslogtreecommitdiffstats
path: root/ansible_collections/dellemc/powerflex/playbooks/modules/snapshot.yml
blob: 33975539c49dc29fc801e4efc2eda34081a934a8 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
- name: Snapshot Operations
  hosts: localhost
  connection: local
  gather_facts: false
  vars:
    hostname: 'x.x.x.x'
    username: 'admin'
    password: 'Password'
    validate_certs: false

  tasks:
    - name: Create snapshot
      register: result
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_name: "ansible_snapshot_1"
        vol_name: "ansible_volume"
        state: "present"

    - name: Set snapshot id
      ansible.builtin.set_fact:
        snapshot_id: "{{ result.snapshot_details.id }}"

    - name: Create snapshot with retention
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_name: "ansible_snapshot_2"
        vol_name: "ansible_volume"
        desired_retention: 2
        state: "present"

    - name: Get snapshot details using snapshot id
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_id: "{{ snapshot_id }}"
        state: "present"

    - name: Modify the retention
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_name: "ansible_snapshot_2"
        desired_retention: 4
        state: "present"

    - name: Map snapshot to SDC
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_id: "{{ snapshot_id }}"
        sdc:
          - sdc_ip: '**.**.**.**'
          - sdc_id: "663ac0d200000001"
        allow_multiple_mappings: true
        sdc_state: "mapped"
        state: "present"

    - name: Modify the attributes of SDC mapped to snapshot
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_id: "{{ snapshot_id }}"
        sdc:
          - sdc_ip: '**.**.**.**'
            iops_limit: 11
            bandwidth_limit: 4096
          - sdc_id: "663ac0d200000001"
            iops_limit: 20
            bandwidth_limit: 2048
        sdc_state: "mapped"
        state: "present"

    - name: Extend the size of snapshot
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_id: "{{ snapshot_id }}"
        size: 16
        state: "present"

    - name: Unmap SDCs from snapshot
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_id: "{{ snapshot_id }}"
        sdc:
          - sdc_ip: '**.**.**.**'
          - sdc_id: "663ac0d200000001"
        sdc_state: "unmapped"
        state: "present"

    - name: Rename snapshot
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_id: "{{ snapshot_id }}"
        snapshot_new_name: "ansible_renamed_snapshot"
        state: "present"

    - name: Delete snapshot
      dellemc.powerflex.snapshot:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        snapshot_id: "{{ snapshot_id }}"
        remove_mode: "ONLY_ME"
        state: "absent"