Skip to content

Commit 866fc88

Browse files
committed
Update Blog “how-to-use-dscc-api-and-ansible-to-collect-the-storage-configuration”
1 parent 609adfa commit 866fc88

File tree

1 file changed

+9
-76
lines changed

1 file changed

+9
-76
lines changed

content/blog/how-to-use-dscc-api-and-ansible-to-collect-the-storage-configuration.md

Lines changed: 9 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -131,85 +131,18 @@ Capturing the current storage configuration in order to verify it against best p
131131

132132

133133

134+
Used Playbook hierarchy:
134135

135136

136137

138+
* Capture-Systems.yaml
137139

140+
* DSCC-API-Call.yaml
141+
* DSCC-API-401.yaml
142+
* Loop-Systems.yaml
138143

144+
* Loop-Links.yaml
139145

140-
```
141-
---
142-
- name: Capture System Configuration
143-
# Capture the details of all Systems
144-
# v1.0 12/20/2024 Thomas Beha
145-
# Parameter:
146-
# -
147-
#
148-
# Accessed data file:
149-
#
150-
#
151-
# Run command:
152-
# ansible-playbook Capture-Systems.yaml 1>CaptureSystem.log 2>CaptureSystem.err
153-
#
154-
155-
hosts: localhost
156-
vars:
157-
method: "GET"
158-
159-
tasks:
160-
- name: DSCC API Call GET storage systems
161-
vars:
162-
request_uri: "/api/v1/storage-systems"
163-
ansible.builtin.include_tasks:
164-
file: DSCC-API-Call.yaml
165-
166-
- name: Retry the command if status 401
167-
vars:
168-
request_uri: "/api/v1/storage-systems"
169-
ansible.builtin.include_tasks:
170-
file: DSCC-API-401.yaml
171-
when: status == '401'
172-
173-
- name: Set Systems
174-
ansible.builtin.set_fact:
175-
systems: "{{ response.json['items'] }}"
176-
when: status in ['200', '201']
177-
178-
- name: Initialize Storage system dictionary if not defined
179-
ansible.builtin.set_fact:
180-
storage_systems: "{{ storage_systems | default({}) }}"
181-
- name: Create StorageSystems Dictionary
182-
ansible.builtin.set_fact:
183-
storage_systems: "{{ storage_systems | combine({item.name: {'id': item.id, 'resourceUri': item.resourceUri}}) }}"
184-
with_items: "{{ systems }}"
185-
186-
- name: Loop Systems
187-
vars:
188-
ansible.builtin.include_tasks:
189-
file: Loop-Systems.yaml
190-
with_dict: "{{storage_systems}}"
191-
loop_control:
192-
loop_var: my_system
193-
194-
- name: Get HostGroups
195-
vars:
196-
request_uri: "/api/v1/host-initiator-groups"
197-
ansible.builtin.include_tasks:
198-
file: DSCC-API-Call.yaml
199-
- name: Store the HostGroups
200-
ansible.builtin.copy:
201-
content: "{{ response.json | to_nice_json }}"
202-
dest: "../Outputs/hostGroups.json"
203-
mode: '0644'
204-
when: response.json is defined
205-
206-
- name: Get Hosts
207-
ansible.builtin.include_tasks:
208-
file: GetAllHosts.yaml
209-
- name: Store the Hosts
210-
ansible.builtin.copy:
211-
content: "{{ response.json | to_nice_json }}"
212-
dest: "../Outputs/hosts.json"
213-
mode: '0644'
214-
when: response.json is defined
215-
```
146+
147+
148+
Playbooks currently stored at: <https://github.com/tbeha/DSCC-Ansible>

0 commit comments

Comments
 (0)