Role - metalsmith_deployment¶
This role deploys instances using metalsmith CLI.
Variables¶
The only required variable is:
metalsmith_instanceslist of instances to provision, see Instance for instance description.
The following optional variables provide the defaults for Instance attributes:
metalsmith_candidatesthe default for
candidates.metalsmith_capabilitiesthe default for
capabilities.metalsmith_conductor_groupthe default for
conductor_group.metalsmith_debugShow extra debug information, defaults to
false.metalsmith_extra_argsthe default for
extra_args.metalsmith_imagethe default for
image.metalsmith_image_checksumthe default for
image_checksum.metalsmith_image_kernelthe default for
image_kernel.metalsmith_image_ramdiskthe default for
image_ramdisk.metalsmith_netbootthe default for
netbootmetalsmith_nicsthe default for
nics.metalsmith_resource_classthe default for
resource_class.metalsmith_root_sizethe default for
root_size.metalsmith_ssh_public_keysthe default for
ssh_public_keys.metalsmith_statethe default state for instances, valid values are
reserved,absentor the default valuepresent.metalsmith_swap_sizethe default for
swap_size.metalsmith_traitsthe default for
traits.metalsmith_user_namethe default for
user_name, the default value ismetalsmith.
Instance¶
Each instances has the following attributes:
candidates(defaults tometalsmith_candidates)list of nodes (UUIDs or names) to be considered for deployment.
capabilities(defaults tometalsmith_capabilities)node capabilities to request when scheduling.
config_driveextra data to add to the config-drive generated for this instance:
cloud_configDict of cloud-init cloud-config tasks to run on node boot. The ‘users’ directive can be used to configure extra users other than the ‘user_name’ admin user.
meta_dataExtra metadata to include with the config-drive metadata. This will be added to the generated metadata
public_keys,uuid,name, andhostname.
conductor_group(defaults tometalsmith_conductor_group)conductor group to pick nodes from.
Note
Currently it’s not possible to specify the default group.
extra_args(defaults tometalsmith_extra_args)additional arguments to pass to the
metalsmithCLI on all calls. (No longer supported, will raise an error if used)image(defaults tometalsmith_image)UUID, name or HTTP(s) URL of the image to use for deployment. Mandatory.
image_checksum(defaults tometalsmith_image_checksum)SHA256 checksum or checksum file URL for an HTTP(s) image.
image_kernel(defaults tometalsmith_image_kernel)URL of the kernel image if and only if the
imageis a URL of a partition image.image_ramdisk(defaults tometalsmith_image_ramdisk)URL of the ramdisk image if and only if the
imageis a URL of a partition image.netbootwhether to boot the deployed instance from network (PXE, iPXE, etc). The default is to use local boot (requires a bootloader on the image).
nics(defaults tometalsmith_nics)list of virtual NICs to attach to node’s physical NICs. Each is an object with exactly one attribute:
networkcreates a port on the given network, for example:
nics: - network: private - network: ctlplane
can optionally take a fixed IP to assign:
nics: - network: private fixed_ip: 10.0.0.2 - network: ctlplane fixed_ip: 192.168.42.30
portuses the provided pre-created port:
nics: - port: b2254316-7867-4615-9fb7-911b3f38ca2a
subnetcreates a port on the given subnet, for example:
nics: - subnet: private-subnet1
resource_class(defaults tometalsmith_resource_class)requested node’s resource class. Mandatory.
root_size(defaults tometalsmith_root_size)size of the root partition (in GiB), if partition images are used.
Note
Also required for whole-disk images due to how the Bare Metal service currently works.
ssh_public_keys(defaults tometalsmith_ssh_public_keys)list of file names with SSH public keys to put to the node.
swap_size(defaults tometalsmith_swap_size)size of the swap partition (in MiB), if partition images are used (it’s an error to set it for a whole disk image).
traitslist of traits the node should have.
user_name(defaults tometalsmith_user_name)name of the user to create on the instance via configdrive. Requires cloud-init on the image.
Example¶
---
- hosts: all
tasks:
- include_role:
name: metalsmith_deployment
vars:
metalsmith_image: centos7
metalsmith_nics:
- network: ctlplane
metalsmith_ssh_public_keys:
- /home/user/.ssh/id_rsa.pub
metalsmith_instances:
- hostname: compute-0
resource_class: compute
root_size: 100
swap_size: 4096
capabilities:
boot_mode: uefi
traits:
- CUSTOM_GPU
- hostname: compute-1
resource_class: compute
root_size: 100
swap_size: 4096
capabilities:
boot_mode: uefi
user_name: heat-admin
- hostname: compute-2
resource_class: compute
candidates:
- e63650f2-4e7d-40b2-8932-f5b0e54698c7
- f19d00dd-60e1-46c8-b83c-782b4d291d9e
- hostname: control-0
resource_class: control
capabilities:
boot_mode: uefi
nics:
- network: ctlplane
- port: 1899af15-149d-47dc-b0dc-a68614eeb5c4
- hostname: custom-partition-image
resource_class: custom
image: https://example.com/images/custom-1.0.root.img
image_kernel: https://example.com/images/custom-1.0.vmlinuz
image_ramdisk: https://example.com/images/custom-1.0.initrd
image_checksum: https://example.com/images/SHA256SUMS
- hostname: custom-whole-disk-image
resource_class: custom
image: https://example.com/images/custom-1.0.qcow2
image_checksum: https://example.com/images/SHA256SUMS
Module - metalsmith_instances¶
Module Documentation¶
Provision and unprovision ironic baremetal instances using metalsmith, which is a a simple tool to provision bare metal machines using OpenStack Bare Metal Service (ironic) and, optionally, OpenStack Image Service (glance) and OpenStack Networking Service (neutron).
Options¶
- instances:
List of node description dicts to perform operations on
- clean_up:
Clean up resources on failure
- state:
Desired provision state, "present" to provision, "absent" to unprovision, "reserved" to create an allocation record without changing the node state
- wait:
A boolean value instructing the module to wait for node provision to complete before returning. A 'yes' is implied if the number of instances is more than the concurrency.
- timeout:
An integer value representing the number of seconds to wait for the node provision to complete.
- concurrency:
Maximum number of instances to provision at once. Set to 0 to have no concurrency limit
- log_level:
Set the logging level for the log which is available in the returned 'logging' result.
Authors¶
- :
Steve Baker (@stevebaker)
Example Tasks¶
- name: Provision instances
metalsmith_instances:
instances:
- name: node-0
hostname: compute-0
image: overcloud-full
state: present
wait: true
clean_up: false
timeout: 1200
concurrency: 20
log_level: info
register: baremetal_provisioned
- name: Metalsmith log for provision instances
debug:
var: baremetal_provisioned.logging