-
Notifications
You must be signed in to change notification settings - Fork 1
/
ome-device-info.yml
75 lines (64 loc) · 2.03 KB
/
ome-device-info.yml
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
---
- hosts: mx
connection: local
name: Get Device Inventory by Service Tag
gather_facts: False
vars_files:
- vault.yml
tasks:
- name: Get device id by service tag
dellemc.openmanage.ome_device_info:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
fact_subset: "basic_inventory"
system_query_options:
filter: "DeviceServiceTag eq '{{ service_tag }}'"
register: output
- copy:
content: "{{ output }}"
dest: "/tmp/dellemc.openmanage.ome_device_info_basic_{{inventory_hostname}}.txt"
- set_fact:
device_id: "{{ output.device_info.value[0].Id }}"
cacheable: yes
- set_fact:
device_model: "{{ output.device_info.value[0].Model }}"
cacheable: yes
- set_fact:
device_idrac_ip: "{{ output.device_info.value[0].DeviceManagement[0].NetworkAddress }}"
cacheable: yes
- set_fact:
device_idrac_mac: "{{ output.device_info.value[0].DeviceManagement[0].MacAddress }}"
cacheable: yes
- debug:
var: "{{ item }}"
loop:
- device_id
- device_model
- device_idrac_ip
- device_idrac_mac
- name:
debug:
msg: "Rackmount"
when: device_model is match("PowerEdge R.*")
- name:
debug:
msg: "FX2"
when: device_model is match("PowerEdge FC.*")
- name:
debug:
msg: "MX7000"
when: device_model is match("PowerEdge MX.*")
- name: Get detailed hardware inventory
dellemc.openmanage.ome_device_info:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
fact_subset: "detailed_inventory"
system_query_options:
device_service_tag:
- "{{ service_tag }}"
register: deviceinfo
- copy:
content: "{{ deviceinfo }}"
dest: "/tmp/dellemc.openmanage.ome_device_info_{{inventory_hostname}}.txt"