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.

Shared sections

The following shared sections can be specified inside the template defaults, or directly inside each OpenNebula provision object (cluster, datastore, virtual network, and host). Parameters specified on the object side have higher priority and override the parameters from defaults.

connection

This section contains parameters for the remote SSH connection on the privileged user or the user with escalation rights (via sudo) of the newly provisioned host(s).

Parameter

Default

Description

remote_user

root

Remote user to connect via SSH.

remote_port

22

Remote SSH service port.

public_key

/var/lib/one/.ssh-oneprovision/id_rsa.pub

Path or content of the SSH public key.

private_key

/var/lib/one/.ssh-oneprovision/id_rsa

Path or content of the SSH private key.

provision

This section contains parameters for the provisioning provider.

Parameter

Default

Description

provider

none, needs to be specified

Host provision driver.

configuration

This section provides parameters for the host configuration process (e.g. KVM installation, host networking etc.). All parameters are passed to the external configuration tool (Ansible), and all available parameters are covered by the configuration chapter.

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