ome_deployment (Resource)

This terraform resource is used to manage template deployment entity of OME. We can Create, Update and Delete the OME Deployments using this resource. We can also do an ‘Import’ an existing ‘Deployment’ from OME .

~> Note: Atleast one of ref_template_name and ref_template_id and exactly one of device_ids and device_servicetags are required.

Example Usage

/*
Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved.
Licensed under the Mozilla Public License Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://mozilla.org/MPL/2.0/
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

# Deploy template using Device Service tags
resource "ome_deployment" "deploy-template-1" {
  template_name      = "deploy-template-1"
  device_servicetags = ["MXL1234", "MXL1235"]
  job_retry_count    = 30
  sleep_interval     = 10
}

# Deploy template using Device Id's
resource "ome_deployment" "deploy-template-2" {
  template_name = "deploy-template-2"
  device_ids    = [10001, 10002]
}

# Get Deviceid's or servicetags from a specified list of groups
data "ome_groupdevices_info" "gd" {
  device_group_names = ["WINDOWS"]
}

# Deploy template for group by fetching the device ids using data sources
resource "ome_deployment" "deploy-template-3" {
  template_name = "deploy-template-3"
  device_ids    = data.ome_groupdevices_info.gd.device_ids
}

# Deploy template using Device Service tags with Schedule
resource "ome_deployment" "deploy-template-4" {
  template_name      = "deploy-template-4"
  device_servicetags = ["MXL1234"]
  run_later          = true
  cron               = "0 45 12 19 10 ? 2022"
}

# Deploy template using Device ids and deploy device attributes
resource "ome_deployment" "deploy-template-5" {
  template_name = "deploy-template-5"
  device_ids    = [10001, 10002]
  device_attributes = [
    {
      device_servicetags = ["MXL12345", "MXL23456"]
      attributes = [
        {
          attribute_id = 1197967
          display_name = "ServerTopology 1 Aisle Name"
          value        = "aisle updated value"
          is_ignored   = false
        }
      ]
    }
  ]
}

# Deploy template using Device ids and boot to network iso
resource "ome_deployment" "deploy-template-6" {
  template_name = "deploy-template-6"
  device_ids    = [10001, 10002]
  boot_to_network_iso = {
    boot_to_network = true
    share_type      = "CIFS"
    iso_timeout     = 240
    iso_path        = "/cifsshare/unattended/unattended_rocky8.6.iso"
    share_detail = {
      ip_address = "192.168.0.2"
      share_name = ""
      work_group = ""
      user       = "username"
      password   = "password"
    }
  }
  job_retry_count = 30
}

# Deploy template using Device ids by changing the job_retry_count and sleep_interval and ignore the same during updates
resource "ome_deployment" "deploy-template-7" {
  device_servicetags = ["MXL1234"]
  job_retry_count    = 30
  sleep_interval     = 10

  lifecycle {
    ignore_changes = [
      job_retry_count,
      sleep_interval
    ]
  }
}

# Deploy template using Device service tags and groupnames
resource "ome_deployment" "deploy-template-8" {
  template_id        = 614
  device_servicetags = concat(data.ome_groupdevices_info.gd.device_servicetags, ["MXL1235"])
}

After the execution of above resource block, template deployment would have been finished on the OME. For more information, Please check the terraform state file.

Schema

Optional

  • boot_to_network_iso (Object) Boot To Network ISO deployment details. (see below for nested schema)
  • cron (String) Cron to schedule the deployment task. Cron expression should be of future datetime.
  • device_attributes (List of Object) List of template attributes associated with the target devices for deploymnent. (see below for nested schema)
  • device_ids (Set of Number) List of the device id(s). Conflicts with device_servicetags.
  • device_servicetags (Set of String) List of the device servicetags. Conflicts with device_ids.
  • forced_shutdown (Boolean) Force shutdown after deployment.
  • job_retry_count (Number) Number of times the job has to be polled to get the final status of the resource. Default value is 20.
  • options_continue_on_warning (Boolean) Continue to run the job on warnings.
  • options_precheck_only (Boolean) Option to precheck
  • options_strict_checking_vlan (Boolean) Checks the strict association of vlan.
  • options_time_to_wait_before_shutdown (Number) Option to specify the time to wait before shutdown in seconds. Default and minimum value is 300 and maximum is 3600 seconds respectively. Default value is 300.
  • power_state_off (Boolean) End power state of a target devices. Default power state is ON. Make it true to switch it to OFF state.
  • run_later (Boolean) Provides options to schedule the deployment task immediately, or at a specified time.
  • sleep_interval (Number) Sleep time interval for job polling in seconds. Default value is 60.
  • template_id (Number) ID of the existing template. If a template with this ID is found, template_name will be ignored. Cannot be updated.
  • template_name (String) Name of the existing template. Cannot be updated.

Read-Only

  • id (String) ID of the deploy resource.

Nested Schema for boot_to_network_iso

Optional:

  • boot_to_network (Boolean)
  • iso_path (String)
  • iso_timeout (Number)
  • share_detail (Object) (see below for nested schema)
  • share_type (String)

Nested Schema for boot_to_network_iso.share_detail

Optional:

  • ip_address (String)
  • password (String)
  • share_name (String)
  • user (String)
  • work_group (String)

Nested Schema for device_attributes

Optional:

Nested Schema for device_attributes.attributes

Optional:

  • attribute_id (Number)
  • display_name (String)
  • is_ignored (Boolean)
  • value (String)

Import

Import is supported using the following syntax:

# /*
# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved.
# Licensed under the Mozilla Public License Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#     http://mozilla.org/MPL/2.0/
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# */

terraform import ome_deployment.deploy-template-3 "<existing_deployment_name>"