Make specs, types and flavors more extensible
* Give specs an optional Ironic config field * Add bmc_type field to attempt to decouple IPMI * Add nova_flavors to allow flavor creation
This commit is contained in:
parent
c89a70bd94
commit
7421c49937
@ -31,8 +31,7 @@ class ActionModule(ActionBase):
|
||||
The following task vars are accepted:
|
||||
:hypervisor_vars: A dict of hostvars for each hypervisor, keyed
|
||||
by hypervisor hostname. Required.
|
||||
:specs: A dict mapping node type names to the number of nodes
|
||||
required of that type. Required.
|
||||
:specs: A list of node specifications to be instantiated. Required.
|
||||
:node_types: A dict mapping node type names to a dict of properties
|
||||
of that type.
|
||||
:node_name_prefix: A string with which to prefix all sequential
|
||||
@ -48,7 +47,15 @@ class ActionModule(ActionBase):
|
||||
|
||||
nodes = []
|
||||
idx = 0
|
||||
for typ, cnt in six.iteritems(task_vars['specs']):
|
||||
for spec in task_vars['specs']:
|
||||
try:
|
||||
typ = spec['type']
|
||||
cnt = spec['count']
|
||||
except KeyError:
|
||||
e = ("All specs must contain a `type` and a `count`. "
|
||||
"Offending spec: %s" % spec)
|
||||
raise AnsibleActionFail(to_text(e))
|
||||
|
||||
for _ in six.moves.range(cnt):
|
||||
node = deepcopy(task_vars['node_types'][typ])
|
||||
# Set the type, for future reference.
|
||||
|
@ -1,7 +1,4 @@
|
||||
---
|
||||
allocations_file_path: >-
|
||||
{{ '/'.join([(playbook_dir | dirname), 'allocations.yml']) }}
|
||||
|
||||
# node_types is a dict that defines different sets of node specifications,
|
||||
# keyed by a 'node type name' to associate with each set of specifications. An
|
||||
# example of the format of this variable is below:
|
||||
@ -21,19 +18,82 @@ allocations_file_path: >-
|
||||
# # vars.
|
||||
# physical_networks:
|
||||
# - physnet1
|
||||
# # The BMC type for nodes of this type. If not set, `default_bmc_type`
|
||||
# # will be used.
|
||||
# bmc_type: ipmi
|
||||
node_types: {}
|
||||
|
||||
# specs is a dict that maps different node type names (define in `node_types`
|
||||
# above) to the number of nodes of that type that are to be created. Only node
|
||||
# types which you want to create nodes from need be keyed here. For example:
|
||||
# specs is a list of configurations of nodes to be created. Each configuration
|
||||
# can specify the number of nodes to be created, the type (from `node_types`)
|
||||
# of these nodes, and optionally configuration for the Ironic nodes to be
|
||||
# enroled from these nodes. If `ironic_config` is not set, Ironic enrolment
|
||||
# will be skipped for that spec.
|
||||
# For example:
|
||||
#
|
||||
# specs:
|
||||
# # Create four nodes with the specifications defined in `node_types` by
|
||||
# # 'type0'.
|
||||
# type0: 4
|
||||
specs: {}
|
||||
# # Required.
|
||||
# - type: type0
|
||||
# # Required.
|
||||
# count: 4
|
||||
# # Optional.
|
||||
# ironic_config:
|
||||
# # Required.
|
||||
# resource_class: my_rc
|
||||
# # Optional - defaults to [].
|
||||
# traits: []
|
||||
# # The following variables are all optional; if not set, a default will
|
||||
# # be inferred from the `bmc_type` specified by the node type `type`.
|
||||
# hardware_type: ipmi
|
||||
# boot_interface: pxe
|
||||
# deploy_interface: iscsi
|
||||
# management_interface: ipmitool
|
||||
# power_interface: ipmitool
|
||||
specs: []
|
||||
|
||||
# nova_flavors is a list of Nova flavors to be created. Each flavor must
|
||||
# specify the resource class it is associated with. This resource class must
|
||||
# be referenced in `specs`.
|
||||
#
|
||||
# For example:
|
||||
#
|
||||
# nova_flavors:
|
||||
# # Required.
|
||||
# - resource_class: my_rc
|
||||
# # Defaults to `resource_class`.
|
||||
# name: my_flavor
|
||||
# # Optional, defaults to [].
|
||||
# required_traits: []
|
||||
# # Optional, defaults to [].
|
||||
# forbidden_traits: []
|
||||
nova_flavors: []
|
||||
|
||||
# The Glance UUID of the image to use for the deployment kernel.
|
||||
deploy_kernel_uuid:
|
||||
# The Glance UUID of the image to use for the deployment ramdisk.
|
||||
deploy_ramdisk_uuid:
|
||||
|
||||
|
||||
allocations_file_path: >-
|
||||
{{ '/'.join([(playbook_dir | dirname), 'allocations.yml']) }}
|
||||
|
||||
# The default BMC type of a node. Can be overridden per-node.
|
||||
default_bmc_type: ipmi
|
||||
# Maps BMC types to a dict containing default values for Ironic node
|
||||
# interfaces, a hardware type, and a BMC emulation tool to use. Any of these
|
||||
# values can be overridden per-node.
|
||||
default_bmc_info:
|
||||
ipmi:
|
||||
bmc_emulator: virtualbmc
|
||||
hardware_type: ipmi
|
||||
boot_interface: pxe
|
||||
deploy_interface: iscsi
|
||||
management_interface: ipmitool
|
||||
power_interface: ipmitool
|
||||
# NOTE(w-miller): Redfish is not currently fully supported by Tenks.
|
||||
redfish:
|
||||
bmc_emulator: sushy-tools
|
||||
hardware_type: redfish
|
||||
boot_interface: pxe
|
||||
deploy_interface: iscsi
|
||||
management_interface: redfish
|
||||
power_interface: redfish
|
||||
|
@ -7,9 +7,11 @@
|
||||
tasks:
|
||||
- name: Check that all specified node types exist
|
||||
fail:
|
||||
msg: The non-existent node type {{ item }} was specified in 'specs'.
|
||||
when: item not in node_types
|
||||
loop: "{{ specs.keys() }}"
|
||||
msg: >
|
||||
The non-existent node type {{ item.type }} was specified in
|
||||
'specs'.
|
||||
when: item.type not in node_types
|
||||
loop: "{{ specs }}"
|
||||
|
||||
# Creates a dict mapping each hypervisor's hostname to its hostvars, to be
|
||||
# used during scheduling.
|
||||
|
Loading…
x
Reference in New Issue
Block a user