Skip to main content

Templater

The Templater handles the creation and deletion of virtual machine templates for the vmware environment from Template type Deputy packages.

Endpoints​

The Templater has two gRPC endpoints:

create​

Creates a template from a given Deputy package. Duplicate templates of the same Deputy source package are not uploaded. This is achieved by naming the templates after the checksum of the source package.

During the creation of the template the existing network devices are removed. It is still recommended to remove them by hand when before creating the VM Deputy package as it may be prone to errors depending on the vSphere version.

note

If the template already exists in the vSphere environment, the deputy package is not downloaded into the handler and the Accounts info is not extracted from it. The Accounts field will be empty in the response. The accounts information is stored on the Rangers database, if that is lost the template will need to be deleted and then reuploaded for it to populate the Database again.

Request​

message Source {
string name = 1;
string version = 2;
}

Successful Response​

message TemplateResponse {
Identifier identifier = 1;
repeated Account accounts = 2;
}

For reference, the Identifier and Account messages are defined as follows:

message Identifier {
string value = 1;
}

message Account {
string username = 1;
string password = 2;
string private_key = 3;
}

delete​

Deletes a previously uploaded template.

Request​

message Identifier {
string value = 1;
}

Successful Response​

message Empty {}

Configuration​

The following configuration options are available for the Templater handler:

VariableMandatoryTypeRules
useryesstringvCenter username
passwordyesstringvCenter password
hostnameyesstringAddress of the vCenter environment
insecureyesboolEnables or disables certificate verification for the vSphere client
template_folder_pathyesstringThe storage folder for templates
resource_pool_pathyesstringThe resource pool to be used
datastore_pathyesstringThe datastore to be used
server_addressyesstringThe handlers own address and port

Example configuration file:

user: vsphere_username
password: vsphere_password
hostname: my-vsphere.net
insecure: true
template_folder_path: /Datacenter/vm/Templates/*
resource_pool_path: /Datacenter/host/Cluster/Resources/Handlers
datastore_path: /Datacenter/datastore/Handlers
server_address: 0.0.0.0:7777