Debian Codegraph @

ansible_collections/dellemc/powerflex/playbooks/modules/snapshot.yml

raw symbols SCIP
1 ---
2 - name: Snapshot Operations
3 hosts: localhost
4 connection: local
5 gather_facts: false
6 vars:
7 hostname: 'x.x.x.x'
8 username: 'admin'
9 password: 'Password'
10 validate_certs: false
11
12 tasks:
13 - name: Create snapshot
14 register: result
15 dellemc.powerflex.snapshot:
16 hostname: "{{ hostname }}"
17 username: "{{ username }}"
18 password: "{{ password }}"
19 validate_certs: "{{ validate_certs }}"
20 snapshot_name: "ansible_snapshot_1"
21 vol_name: "ansible_volume"
22 state: "present"
23
24 - name: Set snapshot id
25 ansible.builtin.set_fact:
26 snapshot_id: "{{ result.snapshot_details.id }}"
27
28 - name: Create snapshot with retention
29 dellemc.powerflex.snapshot:
30 hostname: "{{ hostname }}"
31 username: "{{ username }}"
32 password: "{{ password }}"
33 validate_certs: "{{ validate_certs }}"
34 snapshot_name: "ansible_snapshot_2"
35 vol_name: "ansible_volume"
36 desired_retention: 2
37 state: "present"
38
39 - name: Get snapshot details using snapshot id
40 dellemc.powerflex.snapshot:
41 hostname: "{{ hostname }}"
42 username: "{{ username }}"
43 password: "{{ password }}"
44 validate_certs: "{{ validate_certs }}"
45 snapshot_id: "{{ snapshot_id }}"
46 state: "present"
47
48 - name: Modify the retention
49 dellemc.powerflex.snapshot:
50 hostname: "{{ hostname }}"
51 username: "{{ username }}"
52 password: "{{ password }}"
53 validate_certs: "{{ validate_certs }}"
54 snapshot_name: "ansible_snapshot_2"
55 desired_retention: 4
56 state: "present"
57
58 - name: Map snapshot to SDC
59 dellemc.powerflex.snapshot:
60 hostname: "{{ hostname }}"
61 username: "{{ username }}"
62 password: "{{ password }}"
63 validate_certs: "{{ validate_certs }}"
64 snapshot_id: "{{ snapshot_id }}"
65 sdc:
66 - sdc_ip: '**.**.**.**'
67 - sdc_id: "663ac0d200000001"
68 allow_multiple_mappings: true
69 sdc_state: "mapped"
70 state: "present"
71
72 - name: Modify the attributes of SDC mapped to snapshot
73 dellemc.powerflex.snapshot:
74 hostname: "{{ hostname }}"
75 username: "{{ username }}"
76 password: "{{ password }}"
77 validate_certs: "{{ validate_certs }}"
78 snapshot_id: "{{ snapshot_id }}"
79 sdc:
80 - sdc_ip: '**.**.**.**'
81 iops_limit: 11
82 bandwidth_limit: 4096
83 - sdc_id: "663ac0d200000001"
84 iops_limit: 20
85 bandwidth_limit: 2048
86 sdc_state: "mapped"
87 state: "present"
88
89 - name: Extend the size of snapshot
90 dellemc.powerflex.snapshot:
91 hostname: "{{ hostname }}"
92 username: "{{ username }}"
93 password: "{{ password }}"
94 validate_certs: "{{ validate_certs }}"
95 snapshot_id: "{{ snapshot_id }}"
96 size: 16
97 state: "present"
98
99 - name: Unmap SDCs from snapshot
100 dellemc.powerflex.snapshot:
101 hostname: "{{ hostname }}"
102 username: "{{ username }}"
103 password: "{{ password }}"
104 validate_certs: "{{ validate_certs }}"
105 snapshot_id: "{{ snapshot_id }}"
106 sdc:
107 - sdc_ip: '**.**.**.**'
108 - sdc_id: "663ac0d200000001"
109 sdc_state: "unmapped"
110 state: "present"
111
112 - name: Rename snapshot
113 dellemc.powerflex.snapshot:
114 hostname: "{{ hostname }}"
115 username: "{{ username }}"
116 password: "{{ password }}"
117 validate_certs: "{{ validate_certs }}"
118 snapshot_id: "{{ snapshot_id }}"
119 snapshot_new_name: "ansible_renamed_snapshot"
120 state: "present"
121
122 - name: Delete snapshot
123 dellemc.powerflex.snapshot:
124 hostname: "{{ hostname }}"
125 username: "{{ username }}"
126 password: "{{ password }}"
127 validate_certs: "{{ validate_certs }}"
128 snapshot_id: "{{ snapshot_id }}"
129 remove_mode: "ONLY_ME"
130 state: "absent"