Plugins
By declaring plugins
you can install Python modules and use the installed or preinstalled modules to perform different operations. You can also specify where a specific plugin’s operations will be executed.
Declaration
The plugins
section is a dictionary in which each item in the dictionary represents a plugin to use in the blueprint.
plugins:
plugin1:
...
plugin2:
...
Schema
Keyname | Required | Type | Description |
---|---|---|---|
executor | yes | string | Where to execute the plugin’s operations. Valid Values: central_deployment_agent , host_agent . See Plugin Executor |
source | conditional | string | From where to retrieve the plugin. May be either a path relative to the plugins directory inside the blueprint’s root directory, or a URL. If install is false , source is redundant. If install is true, source (or package_name ) is mandatory. See Source Plugins |
install_arguments | no | string | Optional arguments passed to the ‘pip install’ command created for the plugin installation. |
install | no | boolean | Whether to install the plugin, as it might already be installed as part of the agent. Defaults to true . (Supported since: cloudify_dsl_1_1) |
package_name | conditional | string | Managed plugin package name. See Managed Plugins. (Supported since: cloudify_dsl_1_2) If install is false , package_name is redundant. If install is true, package_name (or source ) is mandatory. |
package_version | no | string | Managed plugin package version. See Managed Plugins. (Supported since: cloudify_dsl_1_2) |
supported_platform | no | string | Managed plugin supported platform (e.g. linux_x86_64 ). See Managed Plugins. (Supported since: cloudify_dsl_1_2) |
distribution | no | string | Managed plugin distribution. See Managed Plugins. (Supported since: cloudify_dsl_1_2) |
distribution_version | no | string | Managed plugin distribution version. See Managed Plugins. (Supported since: cloudify_dsl_1_2) |
distribution_release | no | string | Managed plugin distribution release. See Managed Plugins. (Supported since: cloudify_dsl_1_2) |
Installation Configuration
When a plugin definition is configured with install: true
(which is the default), source
or package_name
must be specified as well.
If package_name
is specified, the Manager is queried for a matching managed plugin. If one is found, it is installed.
If package_name
is not specified, or no matching managed plugin is found, source
is used.
If no managed plugin is found and source
is not defined, plugin installation fails.
Source Plugins
source
specifies where the plugin to be installed is located. May be:
- A URL to an archive of the plugin to be installed.
- The name of a directory containing the plugin, which is expected to be inside the blueprint’s
plugins
directory. - The
source
method should only be used when developing plugins and theskip-plugins-validation
flag should be passed at deployment time.
Managed Plugins
package_name
specifies the name of the managed plugin to be installed. package_version
, supported_platfrom
, distribution
, distribution_version
and distribution_release
may be used to explicitly specify the managed plugin to be installed. Otherwise, an implicit resolution mechanism is utilized that fetches the latest matching managed plugin.
Learn more about using the Cloudify plugin API here
Executor
executor
specifies where the plugin should be installed and where operations using this plugin are to be executed. Valid values are central_deployment_agent
,
in which case the plugin is installed on the central deployment agent, and host_agent
, in which case the plugin is installed on the compute node that contains
the node that maps an operation to the plugin. To override the executor
configuration on a per-operation basis, see operation executor.
Examples
Source Plugin - External
The following is an example of a plugin definition that would be installed via a URL.
plugins:
openstack:
executor: central_deployment_agent
source: https://github.com/cloudify-cosmo/cloudify-openstack-plugin/archive/1.3.zip
node_templates:
vm:
type: openstack.nodes.Server
interfaces:
my_interface:
create: openstack.nove_plugin.server.create
Source Plugin - Packaged With Blueprint
The following is an example of a plugin definition that is pre-bundled with the blueprint, under its plugins
directory.
plugins:
my_blueprint_plugin:
executor: central_deployment_agent
# name of directory containing the plugin inside the blueprint 'plugins' directory
source: my-blueprint-plugin
node_templates:
app:
type: cloudify.nodes.Application
interfaces:
my_interface:
delete: my_blueprint_plugin.blueprint_plugin_package.tasks.delete
Non-Installed Plugin
The following is an example of a plugin definition so that the plugin is not installed. This might be used when a custom agent package, created using the agent-packager, already includes this plugin, meaning that no installation is necessary.
plugins:
my_plugin:
executor: central_deployment_agent
install: false
node_templates:
app:
type: cloudify.nodes.Application
interfaces:
my_interface:
configure: my_plugin.my_plugin_package.operations.configure
Managed Plugin
The following is an example of a plugin definition for a plugin to be installed via the managed plugins mechanism.
plugins:
some_managed_plugin:
executor: host_agent
package_name: some-managed-plugin
node_templates:
app:
type: cloudify.nodes.Application
interfaces:
my_interface:
start: some_managed_plugin.my_managed_plugin_package.operations.start
Install Arguments
The following is an example of a plugin definition for a plugin to be installed with specific install arguments.
plugins:
plugin_with_args:
executor: central_deployment_agn
source: http://www.example.com/path/to/plugin.tar.gz
# pip install will be called with these arguments appended
# with the plugin directory as the current working directory.
install_arguments: -r requirements.txt
node_templates:
app:
type: cloudify.nodes.Application
interfaces:
my_interface:
start: plugin_with_args.withargs_plugin_package.operations.start