terraform-provider-ironic

command module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

README

Build Status License GitHub release

Terraform provider for Ironic

This is a terraform provider that lets you provision baremetal servers managed by Ironic.

Provider

Currently the provider only supports standalone noauth Ironic. At a minimum, the Ironic endpoint URL must be specified. The user may also optionally specify an API microversion.

provider "ironic" {
  url          = "http://localhost:6385/v1"
  microversion = "1.52"
}

Resources

This provider currently implements a number of native Ironic resources, described below.

Nodes

A node describes a hardware resource. A limited subset of provision states are supported, you may specify manage = true or available = true. You may also instruct Ironic to inspect (inspect = true) or clean (clean = true) the node. To bring a node to the active state, i.e. deploy the node - use a deployment resource instead.

resource "ironic_node_v1" "openshift-master-0" {
  name = "openshift-master-0"

  inspect   = true # Perform inspection
  clean     = true # Clean the node
  available = true # Make the node 'available'

  ports = [
    {
      "address"     = "00:bb:4a:d0:5e:38"
      "pxe_enabled" = "true"
    },
  ]

  properties = {
    "local_gb" = "50"
    "cpu_arch" = "x86_64"
  }

  driver = "ipmi"
  driver_info = {
    "ipmi_port"      = "6230"
    "ipmi_username"  = "admin"
    "ipmi_password"  = "password"
    "ipmi_address"   = "192.168.111.1"
    "deploy_kernel"  = "http://172.22.0.1/images/ironic-python-agent.kernel"
    "deploy_ramdisk" = "http://172.22.0.1/images/ironic-python-agent.initramfs"
  }
}

Ports

Ports may be specified as part of the node resource, or as a separate ironic_port_v1 declaration.

resource "ironic_port_v1" "openshift-master-0-port-0" {
  node_uuid   = ironic_node_v1.openshift-master-0.id
  pxe_enabled = true
  address     = "00:bb:4a:d0:5e:38"
}

Allocation

The Allocation resource represents a request to find and allocate a Node for deployment. The microversion must be 1.52 or later.

resource "ironic_allocation_v1" "openshift-master-allocation" {
  name  = "master-${count.index}"
  count = 3

  resource_class = "baremetal"

  candidate_nodes = [
    ironic_node_v1.openshift-master-0.id,
    ironic_node_v1.openshift-master-1.id,
    ironic_node_v1.openshift-master-2.id,
  ]

  traits = [
    "CUSTOM_FOO",
  ]
}

Deployment

A deployment will provision a baremetal node, using the information given in the resource. The count metaparameter can be used to deploy multiple nodes. Terraform will drive the Ironic state machine to bring the node to an active state. The separation of deployment from the baremetal node defintion allows a user to manage their hardware outside of the provider if desired. Destruction of a deployment brings the baremetal node back to the available state.

Users may specify a node_uuid directly, or make use of the allocation resource to dynamically pick a node.

resource "ironic_deployment" "masters" {
  count     = 3
  node_uuid = "${element(ironic_allocation_v1.openshift-master-allocation.*.node_uuid, count.index)}"

  instance_info = {
    image_source   = "http://172.22.0.1/images/redhat-coreos-maipo-latest.qcow2"
    image_checksum = "26c53f3beca4e0b02e09d335257826fd"
  }

  user_data    = var.user_data
  network_data = var.network_data
  metadata     = var.metadata
}

License

Apache 2.0, See LICENSE file

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL