Changing the power state of servers
Uses this definition to perform a power action on servers that are managed by Lenovo XClarity Orchestrator and then return the power status of that server.
Usage
resource "lxco_server" "power_action" {
group_ids = array of strings
power_action = string
resource_ids = array of strings
}
output "power_action" {
value = lxco_server.power_action
}
Example
The following example restarts two server and powers on a group of servers.
terraform {
required_providers {
lxco = {
version = "0.1"
source = "lenovo.com/xclarity/lxco"
}
}
}
provider "lxco" {
host = "192.0.2.0"
# username = ""
# password = ""
}
# Power on specific servers, and return the results
resource "lxco_server" "power_action" {
group_ids = [],
resource_ids = [
"80CE6AB8FF7D11E685CB819F6B26BCF8-AC2E339A942446F4A246BB55B56FB18F"
"00632D78DE644E23B712E200FE449787-97E61EA441F3491B9CC971E68D2D8BCD"
],
power_action = "PowerOn"
}
output "power_action" {
value = lxco_server.power_action
}
# Restart a group of servers, and return the results
resource "lxco_server" "power_action" {
group_ids = ["G_36898672B78D4A93B2829123E7728925"]
resource_ids = [],
power_action = "Restart"
}
output "power_action" {
value = lxco_server.power_action
}
Inputs
Name | Required / Optional | Type | Description | ||
---|---|---|---|---|---|
group_ids | Required | Array of strings | List of device group IDs Specify an empty array if the resource_ids attribute is specified. | ||
power_action | Required | String | Power action. This can be one of the following values.
| ||
resource_ids | Required | Array of strings | List of resources IDs Specify an empty array if the group_ids attribute is specified. |
Outputs
Name | Type | Description | ||
---|---|---|---|---|
id | String | Job ID | ||
power_action | String | Power action that was performed | ||
resource_ids | Array of strings | List of IDs of resources on which the power action was performed | ||
status | Integer | Message about the status of the action |
The following example is returned if the request is successful.
{
"id":"0349DC28D0C411E7B5A47ED30AE32DCF",
"power_action": "PowerOn",
"resource_ids": [
"80CE6AB8FF7D11E685CB819F6B26BCF8-AC2E339A942446F4A246BB55B56FB18F"
"00632D78DE644E23B712E200FE449787-97E61EA441F3491B9CC971E68D2D8BCD"
],
"status": "The power action job launched successfully. The power action job was launched in the
orchestrator server and will be executed asynchronously. Job ID: 125"
}
Give documentation feedback