Gathers facts Oracle Exadata Machine by imageinfo, exadata.img.hw, dmidecode and databasemachine.xml
exa_facts is an ansible custom module that creates and adds four dict to ansible_facts
- exa_img ( from
imageinfo
command )- Image image type
- Kernel version
- Image created
- Image status
- Uptrack kernel version
- Node type
- Image version
- System partition on device
- Image label
- Image kernel version
- Install type
- Image activated
- exa_hw ( from
exadata.img.hw
command )- model
- system_info ( from
dmidecode
command )- SKU Number
- UUID
- Family
- Serial Number
- Version
- Product Name
- Wake-up Type
- Manufacturer
- databasemachine ( from
/opt/oracle.SupportTools/onecommand/databasemachine.xml
file )- ORACLE_CLUSTER PAGES and RACK
- MACHINETYPE
- MACHINETYPES
- RACKCOUNT
- MACHINEUSIZE
- ITEMS
- RACK_SERIAL
- ADMINNAME
- ILOMIP
- UHEIGHT
- ILOMNAME
- ULOCATION
- TYPE
- ADMINIP
- CLIENTNAME
- CLIENTIP
- ORACLE_CLUSTER PAGES and RACK
βββ /library
β βββ exa_facts.py ##<-- python custom module
- This module supports Oracle Exadata Machine
- exa_img require imageinfo command
- exa_hw require exadata.img.hw command
- system_info require dmidecode command
- databasemachine require databasemachine.xml file
- no parameters are needed
Attribute | Support | Description |
---|---|---|
check_mode | full | Can run in check_mode and return changed status prediction without modifying target. |
facts | full | Action returns an ansible_facts dictionary that will update existing host facts. |
"exa_hw": {
"model": "HVM domU"
},
"exa_img": {
"Image image type": "prod",
"Kernel version": "4.14.35-2047.518.4.2.el7uek.x86_64 #2 SMP Thu Nov 3 14:28:31 PDT 2022 x86_64",
"Image created": "2023-03-02 03:40:44 -0800",
"Image status": "success",
"Uptrack kernel version": "4.14.35-2047.522.3.el7uek.x86_64 #2 SMP Fri Jan 20 16:05:02 PST 2023 x86_64",
"Node type": "GUEST",
"Image version": "22.1.9.0.0.230302",
"System partition on device": "/dev/mapper/VGExaDb-LVDbSys1",
"Image label": "OSS_22.1.9.0.0_LINUX.X64_230302",
"Image kernel version": "4.14.35-2047.518.4.2.el7uek",
"Install type": "XEN Guest with InfiniBand",
"Image activated": "2023-09-02 04:02:42 +0200"
},
"system_info": {
"SKU Number": "Not Specified",
"UUID": "123456ba-b12f-1234-acce-be12a34fab56",
"Family": "Not Specified",
"Serial Number": "123456ba-b12f-1234-acce-be12a34fab5",
"Version": "4.4.4OVM",
"Product Name": "HVM domU",
"Wake-up Type": "Power Switch",
"Manufacturer": "Xen"
},
"databasemachine": {
"ORACLE_CLUSTER": {
"PAGE0": {
"RACKS": {
"RACK": {
"MACHINETYPE": "487",
"MACHINEUSIZE": "42",
"ITEMS": "13",
"RACK_SERIAL": "00000000",
"ITEM": [
{
"ADMINNAME": "testceladm04",
"ILOMIP": "10.10.10.10",
"UHEIGHT": "2",
"ILOMNAME": "testceladm04-ilom",
"ULOCATION": "2",
"TYPE": "cellnode",
"ADMINIP": "11.11.11.11"
},
{
"ADMINNAME": "testdbvadm01",
"ILOMIP": "14.14.14.14",
"UHEIGHT": "1",
"ILOMNAME": "testdbvadm01-ilom",
"ULOCATION": "16",
"CLIENTIP": null,
"TYPE": "computenode",
"ADMINIP": "14.14.14.14",
"CLIENTNAME": null
},
{
"ADMINIP": "16.16.16.16",
"ULOCATION": "20",
"TYPE": "ib",
"ADMINNAME": "testsw-iba01",
"UHEIGHT": "1"
},
{
"ADMINIP": "18.18.18.18",
"ULOCATION": "21",
"TYPE": "cisco",
"ADMINNAME": "testsw-adm01",
"UHEIGHT": "1"
},
{
"ADMINIP": "13.13.13.13",
"ULOCATION": "0",
"TYPE": "pdu",
"ADMINNAME": "testsw-pdua01",
"UHEIGHT": "0"
}
],
"MACHINETYPES": "X5-2 Elastic Rack HC 4TB"
}
},
"RACKCOUNT": "1"
}
}
}
- name: Gather exa info
exa_facts:
- name: print exa hw model
debug:
msg: "Model: {{ ansible_facts.exa_hw.model }}"
- name: print exa Image version
debug:
msg: "Image Version: {{ ansible_facts.exa_img['Image version'] }}"
- name: print exa serial number
debug:
msg: "Serial number: {{ ansible_facts.system_info['Serial Number'] }}"
- name: print cell list
debug:
msg: "{{ ansible_facts.databasemachine.ORACLE_CLUSTER.PAGE0.RACKS.RACK.ITEM | selectattr('TYPE', 'equalto', 'cellnode') | map(attribute='ADMINNAME') | list }}"
- name: print ibswitch list
debug:
msg: "{{ ansible_facts.databasemachine.ORACLE_CLUSTER.PAGE0.RACKS.RACK.ITEM | selectattr('TYPE', 'equalto', 'ib') | map(attribute='ADMINNAME') | list }}"
- Ansible sanity test is available in SANITY.md file
- Assuming you are in the root folder of your ansible project.
Specify a module path in your ansible configuration file.
$ vim ansible.cfg
[defaults]
...
library = ./library
...
Create the directory and copy the python modules into that directory
$ mkdir library
$ cp path/to/module library
- If you use Ansible AWX and have no way to edit the control node, you can add the /library directory to the same directory as the playbook .yml file
βββ root repository
β βββ /playbooks
β β βββ /library
β β β βββ exa_facts.py ##<-- python custom module
β β βββ your_playbook.yml ##<-- you playbook
2.1 Or create and edit an ansible.cfg file and create a library dir on top of your repo:
[defaults]
library = library/
βββ root repository
β βββ ansible.cfg
β βββ /library
β β βββ exa_facts.py ##<-- python custom module
β βββ /playbooks
β β βββ your_playbook.yml ##<-- you playbook