Overview
Note
Among various Blueprint types, only VMs support Plugins.
The HyperCloud™ Platform (HCP) lets you create and execute scripts on Virtual Machines (VMs.) These scripts are called Plugins on the HCP portal. The HCP portal supports these interpreters:
Bash
Python
Perl
Ruby
PowerShell
Puppet
To run a Plugin on a VM, you’ll need to install the HCP agent. You can install the HCP agent on the VM using a Blueprint or the Free-from wizard.
Refer to these sections to:
Create your Plugin
Plugins are Docker containers that perform pre-defined tasks. These tasks are executed as steps in your HCP pipeline. You can use Plugins to deploy code, publish artifacts, send notifications, etcetera.
Follow these steps to create a Plugin:
Log in to your HCP portal account.
Click Service Orchestration and navigate to Appstore > Plugins > Click New > Select the Plugin Type from the drop-down list.
Enter these details in your Script Plugin dialog:
Provide a Name for your plugin.
Click +Advance Configuration and enter these details:
Enter a plugin Version.
Enter a brief description of your new Script Plugin.
Select the License from the drop-down list.
Enter the Timeout for your plugin in seconds.
Enter the following in the Scripts text-box:
#!/bin/bash
[1] Use the script below to update your packages:echo "Updating OS packages" sudo apt-get update && sudo apt-get upgrade -y || yum update -y echo "Ping Test to Google DNS Server" ping $IP_ADDRESS -c 8|
If you want to add conditions for your Script Plugin run:
Click Arguments+
Enter the argument Key and its Value.
Example:
Key:IP_ADDRESS
Value:8.8.8.8
To entitle users to your plugin, select:
Only Me: if you do not want anyone to access your plugin.
Everyone: if you want to share your plugin with everyone.
Groups & Users: if you want to share the plugin with specific users or groups.
Enter the first three alphabets of the username in the Users drop-down and select the username.
Type the first three alphabets of the Group Name in the Groups drop-down and select the group name.
Click Save Changes.
Once you create your Plugin, the HCP portal will create a unique REFERENCE ID for the same.
Example: Q5G9A
Note
[1] The HCP portal will replace all occurrences of
$IP_ADDRESS
in the plugin with the value8.8.8.8
However, the HCP portal will ignore the occurrences of
${IP_ADDRESS}
in the plugin
Run plugins on-demand
Users can run plugins on-demand any of their own existing Virtual Machines without the need of connecting to the VM. Use the following steps to run an existing plugin on an existing VM.
Note: Running plugins on an existing VM requires the HyperCloud™ Agent to be installed on the Virtual Machine. The Agent Status must be Connected.
Login to the HyperCloud™ Platform with your credentials Click on Services Orchestration Tab Services
Click on VMs Locate and click on the target VM. Click on Plugins Tab
In the Add Plugins Drop-Down scroll or search the plugin name Select the plugin
Note: If the plugin has been created with Arguments, then text fields will appear under the selected plugin.
To Add more plugins, click on the Add Plugins and scroll or Type and search the name of another plugin
For each plugin, click on +Advance Configuration button and provide the following information
Valid Exit Codes: These Exit codes will be ignored. If none provided, then the default value is 0.
Order: Sequence number to define the order of execution of the plugin.
Note: If no order number is mentioned, all plugins will run at the same time
Click on Run Plugin
Click on the Timeline Tab Wait for a few minutes to see the result of the plugin execution
Add Plugins to an existing Blueprint
Parameters can be used in blueprints to pass or override the default values in a plugin. This allows sharing the same plugin with different blueprints and allows users to customize their deployments as per their choice of parameters.
Configure Your Blueprints to Customize Parameters
To configure Blueprints to customize parameters used by the plugins:
Login to the HyperCloud™ Platform with your credentials.
Click on Services Orchestration >Select AppStore:
Click on Plugins > Locate the plugin and copy the REFERENCE ID for e.g. Q5G9A
Click on AppStore > Click on New > Select the Machine Compose Blueprint from the drop-down list
Enter the following details in your Machine Compose Blueprint
Enter the name for new Machine compose blueprint.
Enter the brief description to your machine compose blueprint.
Select the blueprint type from the drop-down list.
Add the plugins in the YAML Text box as shown below:
Select the Resource pool from the drop-down list
Click on Services Orchestration > Select AppStore > Click on the Blueprints > Click on Edit.
Refer the YAML Syntax below beginning with plugins:
Machine:
region: westus
group: hg-poc
image: Canonical:UbuntuServer:16.04-LTS
instanceType: Standard_D13_v2
resourceGroup: hg-dojo-rg
network: hg-dojo-vnet1
subnet: hg-dojo-vnet1-subnet1
securityGroup: hg-dojo-nsg
skipAgentInstall: false
assignFloatingIP: true
publicIPSku: basic
password: "{{credentials2c9180876f0dbccb016f4f9d87a66886 }}"
count: 1
terminationProtection: DISABLED
plugins:Install Packages
!plugin
id: Q5G9A
order: 1!plugin
Download & Install Security Agent
id: P5H7K
order: 2|
Copy the plugin ID from the Blueprint below for e.g. Q5G9A
Click on the Customizable Params + located under the YAML section or the resource pool as shown below:
The internal reference to the plugin i.e. Machine.plugins.Q5G9A. arguments.IP_ADDRESS will be used to run the plugin on the VM with the value from the blueprint parameters.
The external value key Host will visible to the end-user when provisioning the blueprint:
Mandatory Checkbox: User is forced to enter a value before creating a VM
Password Checkbox: Ensure that sensitive data like password field is masked during input and execution.
Value Text Box : 8.8.8.8 will be a default value if parameter is left unmodified i.e. If the mandatory checkbox is not selected and user creates a VM, then the plugin will get executed with the default value of 8.8.8.8
11. Click Save Changes
12. Click on the Blueprint Click on Request Params
Note: What parameters are marked as mandatory, user must enter a value to be able to Create Virtual Machine.
This completes the steps to provision a VM using blueprints and use plugins to run automation once the VM is deployed successfully.
Overview
Users can add plugins to an existing blueprint by appending the blueprint YAML with the plugin YAML values.
Add Plugin Your Existing Blueprint
To add a plugin to an existing MACHINE_COMPOSE Blueprint YAML:
Login to the HyperCloud™ Platform with your credentials
Click on Services Orchestration >Select AppStore:
Click on Plugins > Locate the plugin and copy the REFERENCE ID for e.g. Q5G9A
Click on AppStore > Click on New > Select the Machine Compose Blueprint from the drop-down list
Enter the following details in your Machine Compose Blueprint
Enter the name for the new Machine compose blueprint.
Enter the brief description to your machine compose blueprint.
Select the blueprint type from the drop-down list.
Enter the snippet for your plugin in the YAML Text box. (Refer to table 1.)
Select the Resource pool from the drop-down list.
Enter the cost profiles.
Enter the following details into your Entitled users to your existing blueprint:
Only Me: If this template is not meant to be shared.
Everyone: If this template is to be shared with everyone in the Tenant.
Groups & Users: if the template is to be shared with specific users or groups.
All Tenants (Only available to Cloud Admins): if the template is to be shared with all tenants.
Click on Save Change.
Once you’ve created the plugin on your existing blueprint, you can go ahead and create your Virtual Machine (VM). To create a VM:
Click Blueprint
Click Create Machine.
Once the VM/Instance is successfully provisioned, the HyperCloud agent gets installed and then execute all the plugins in the blueprint in the order as per the YAML.
Note
plugins: indicates the start of all plugins.
Table number 1.1
Machine: count: 1 | 2c9180876f0dbccb016f4f9d87a66886 }}"
|