Skip to main content

Retrieving a list of all servers

Uses this definition to retrieve a list of all servers that are managed by Lenovo XClarity Orchestrator.

Usage

data "lxco_server" "all" {}

output "all_servers" {
value = data.lxco_server.all
}

Example

The following example retrieves a list of all servers.
terraform {
required_providers {
lxco = {
version = "0.1"
source = "lenovo.com/xclarity/lxco"
}
}
}

provider "lxco" {
host = "192.0.2.0"
# username = ""
# password = ""
}

# Fetch all server details
data "lxco_server" "all" {}

# Return details for all servers
output "all_servers" {
value = data.lxco_server.all
}

Inputs

None

Outputs

NameTypeDescription
serversArray of objectsInformation about each managed server
 domain_nameStringDomain name
 group_namesArray of stringsList of names of the groups to which the device belongs
 health_statusStringHealth state of the device (translated). This can be one of the following values.
  • Normal
  • Warning
  • Critical
  • Unknown
 hostnameStringHostname
 idStringDevice ID
 ipv4_addressesArray of stringsList of IPv4 addresses
 ipv6_addressesArray of stringsList of IPv6 addresses
 locationStringLocation description
 location_lowest_rack_unitStringLowest rack unit
 location_rackStringRack name
 location_roomStringRoom name
 machine_typeStringDevice machine type
 manager_domain_nameStringFully qualified domain name
 manager_hostnameStringHost name
 manager_ipv4_addressesArray of stringsIPv4 addresses
 manager_ipv6_addressesArray of stringsIPv6 addresses
 modelStringDevice model
 power_statusStringPower status (translated). This can be one of the following values.
  • Off
  • On
  • Standby
  • Unknown
 product_nameStringDevice product name
 serial_numberStringDevice serial number
 user_defined_nameStringUser-defined name for the device
 uuidStringDevice UUID
The following example is returned if the request is successful.
{
"servers": [{
"domain_name": "labs.lenovo.com",
"group_names": [],
"health_status": "Warning",
"hostname": "IMM2-3440b5e913f8",
"id": "FAAC1AC51EE411E3A8503440B5EAC7F0-23C87F0A2CB6491097489193447A655C",
"ipv4_addresses": ["10.243.10.193","169.254.95.118"],
"ipv6_addresses": ["2000:1013:0:0:0:0:217:105","fd55:faaf:e1ab:2021:3640:b5ff:fee9:13f8",
"fe80:0:0:0:3640:b5ff:fee9:13f8"],
"location": "Morrisville",
"location_lowest_rack_unit": 0,
"location_rack": "",
"location_room": "",
"machine_type": "7916",
"manager_domain_name": "labs.lenovo.com",
"manager_hostname": "xhmc194",
"manager_ipv4_addresses": ["10.243.2.107"],
"manager_ipv6_addresses": ["fd55:faaf:e1ab:2021:5054:ff:fec4:df97","fe80:0:0:0:5054:ff:fec4:df97"],
"model": "AC1",
"power_status": "On",
"product_name": "IBM Flex System x222 Lower Compute Node with embedded 10Gb Virtual Fabric",
"serial_number": "SLOT002",
"user_defined_name": "*node02_1",
"uuid": "FAAC1AC51EE411E3A8503440B5EAC7F0"
},
{
"domain_name": "labs.lenovo.com",
"group_names": [],
"health_status": "Warning",
"hostname": "IMM2-3440b5ee128c",
"id": "CB62A8381EEF11E387D53440B5EFC518-23C87F0A2CB6491097489193447A655C",
"ipv4_addresses": ["10.243.11.11","169.254.95.118"],
"ipv6_addresses": ["2000:1013:0:0:0:0:217:105","fd55:faaf:e1ab:2021:3640:b5ff:feee:128c",
"fe80:0:0:0:3640:b5ff:feee:128c"],
"location": "Morrisville",
"location_lowest_rack_unit": 0,
"location_rack": "",
"location_room": "",
"machine_type": "7916",
"manager_domain_name": "labs.lenovo.com",
"manager_hostname": "xhmc194",
"manager_ipv4_addresses": ["10.243.2.107"],
"manager_ipv6_addresses": ["fd55:faaf:e1ab:2021:5054:ff:fec4:df97","fe80:0:0:0:5054:ff:fec4:df97"],
"model": "99X",
"power_status": "On",
"product_name": "IBM Flex System x222 Upper Compute Node with embedded 10Gb Virtual Fabric",
"serial_number": "SLOT002",
"user_defined_name": "*node02_2",
"uuid": "CB62A8381EEF11E387D53440B5EFC518"
}]
}