Template Reference¶
The provision is a process of allocating new physical resources from the remote providers. All the information needed is stored in the provision template file and passed to the oneprovision create
command.
In this chapter, we’ll describe the format and content of the provision template.
A provision template is a YAML-formatted file with parameters specifying the new physical resources to be provisioned. It contains:
header (name, configuration playbook, parent template)
global default parameters for
remote connection (SSH),
host provision driver,
host configuration tunables.
list of OpenNebula infrastructure objects (cluster, hosts, datastores, virtual networks) to deploy with overrides to the global defaults above.
list of OpenNebula virtual objects (images, templates, vnet templates, marketplace apps, service templates). See here for more information.
Header¶
Parameter |
Description |
---|---|
|
Name of provision. |
|
Ansible playbook used for hosts configuration. |
|
Parent template to include and extend. Provide the custom absolute filename. |
OpenNebula infrastructure objects¶
Sections cluster
, hosts
, datastores
, networks
contain list of OpenNebula infrastructure objects to be deployed with all the necessary parameters for deployment and creation in OpenNebula. The object structure is a YAML representation of an OpenNebula template with additional shared sections (connection
, provision
, configuration
).
Note
It’s possible to deploy only a single cluster. The section cluster
is a dictionary. All other sections are lists.
Note
Hosts have an special attribute count
, this attribute allow you to deploy the same host multiple times, without having to specify all of them.
The following example, deploy two hosts with the same configuration:
hosts:
- reserved_cpu: 100
im_mad: kvm
vm_mad: kvm
provision:
hostname: "myhost1"
count: 2
The resulting hostnames would be myhost1_0
and myhost1_1
.
Example of datastore defined from regular template:
cat ds.tpl
NAME="myprovision-images"
TM_MAD="ssh"
DS_MAD="fs"
onedatastore create ds.tpl
ID: 328
Example of the same datastore defined in provision template:
datastores:
- name: "myprovision-images"
ds_mad: fs
tm_mad: ssh
OpenNebula virtual objects¶
Sections images
, marketplaceapps
, templates
, vnetemplates
, flowtemplates
contain list of OpenNebula virtual objects to be created with all the necessary parameters for the creation in OpenNebula. The object structure is a YAML representation of and OpenNebula template.
Example of VM template defined from regular template:
cat template.tpl
NAME="test_template"
MEMORY=128
CPU=1
onetemplate create template.tpl
ID: 0
Example of the same VM template defined in provision template:
templates:
- name: "test_template"
memory: 1
cpu: 1