I am trying to to query hosts that have any disks of a certain type.
apiRoute=“https://foreman.example.com/api/v2”
curlCmd=“curl -s -q -u $MYUSER:$MYPW -k”
curlBaseRoute=“$curlCmd $apiRoute”
#curlHosts=“$curlBaseRoute/hosts?per_page=all”
#allHosts=$($curlHosts)
factVals=$($curlBaseRoute/hosts/200/facts?per_page=10000)
#hardWare=$($curlBaseRoute/models)
#disks=$($curlBaseRoute/fact_values?value=“INTEL SSDSC2KB03”)
echo $factVals| jq
❯ ./doit.sh | grep -i logical
“disks::sdb::model”: “LOGICAL VOLUME”,
“disks::sda::model”: “LOGICAL VOLUME”,
“disks::sdd::model”: “LOGICAL VOLUME”,
“blockdevice_sdc_model”: “LOGICAL VOLUME”,
“blockdevice_sdd_model”: “LOGICAL VOLUME”,
“disks::sdc::model”: “LOGICAL VOLUME”,
“blockdevice_sda_model”: “LOGICAL VOLUME”,
“blockdevice_sdb_model”: “LOGICAL VOLUME”,
“disks::sde::model”: “LOGICAL VOLUME”,
“blockdevice_sde_model”: “LOGICAL VOLUME”,
In the UI “name = disks::sda::model” Fact values search will return “INTEL SSDSC2KB03”.
I’d like to write a query to return any host that has any disk of “INTEL SSDSC2KB03”, how can I do this?
Thank You Very Much,
Bruce Smith