@@ -119,4 +119,87 @@ Capturing the current storage configuration in order to verify it against best p
119
119
120
120
121
121
122
- # Gathering the storage configuration
122
+ # Capture the storage system configuration
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+ ```
131
+ ---
132
+ - name: Capture System Configuration
133
+ # Capture the details of all Systems
134
+ # v1.0 12/20/2024 Thomas Beha
135
+ # Parameter:
136
+ # -
137
+ #
138
+ # Accessed data file:
139
+ #
140
+ #
141
+ # Run command:
142
+ # ansible-playbook Capture-Systems.yaml 1>CaptureSystem.log 2>CaptureSystem.err
143
+ #
144
+
145
+ hosts: localhost
146
+ vars:
147
+ method: "GET"
148
+
149
+ tasks:
150
+ - name: DSCC API Call GET storage systems
151
+ vars:
152
+ request_uri: "/api/v1/storage-systems"
153
+ ansible.builtin.include_tasks:
154
+ file: DSCC-API-Call.yaml
155
+
156
+ - name: Retry the command if status 401
157
+ vars:
158
+ request_uri: "/api/v1/storage-systems"
159
+ ansible.builtin.include_tasks:
160
+ file: DSCC-API-401.yaml
161
+ when: status == '401'
162
+
163
+ - name: Set Systems
164
+ ansible.builtin.set_fact:
165
+ systems: "{{ response.json['items'] }}"
166
+ when: status in ['200', '201']
167
+
168
+ - name: Initialize Storage system dictionary if not defined
169
+ ansible.builtin.set_fact:
170
+ storage_systems: "{{ storage_systems | default({}) }}"
171
+ - name: Create StorageSystems Dictionary
172
+ ansible.builtin.set_fact:
173
+ storage_systems: "{{ storage_systems | combine({item.name: {'id': item.id, 'resourceUri': item.resourceUri}}) }}"
174
+ with_items: "{{ systems }}"
175
+
176
+ - name: Loop Systems
177
+ vars:
178
+ ansible.builtin.include_tasks:
179
+ file: Loop-Systems.yaml
180
+ with_dict: "{{storage_systems}}"
181
+ loop_control:
182
+ loop_var: my_system
183
+
184
+ - name: Get HostGroups
185
+ vars:
186
+ request_uri: "/api/v1/host-initiator-groups"
187
+ ansible.builtin.include_tasks:
188
+ file: DSCC-API-Call.yaml
189
+ - name: Store the HostGroups
190
+ ansible.builtin.copy:
191
+ content: "{{ response.json | to_nice_json }}"
192
+ dest: "../Outputs/hostGroups.json"
193
+ mode: '0644'
194
+ when: response.json is defined
195
+
196
+ - name: Get Hosts
197
+ ansible.builtin.include_tasks:
198
+ file: GetAllHosts.yaml
199
+ - name: Store the Hosts
200
+ ansible.builtin.copy:
201
+ content: "{{ response.json | to_nice_json }}"
202
+ dest: "../Outputs/hosts.json"
203
+ mode: '0644'
204
+ when: response.json is defined
205
+ ```
0 commit comments