Agent Packager

The Cloudify Agent is basically a virtualenv in which a series of modules are installed and (optionally) to which a some configuration files are attached.

To use Cloudify with distributions other than the officially supported ones, an Agent Packager tool is provided to assist you to create agents for your distributions.

The purpose of the tool is to:

You can use the Cloudify Agent packager to create an agent on the distribution on which you are running, that uses your distribution and compilers for modules that require compilation.

Creation Process

During the creation process, the agent-packager performs the following actions:

Installation

pip install cloudify-agent-packager

For development purposes:

pip install https://github.com/cloudify-cosmo/cloudify-agent-packager/archive/master.tar.gz

Usage

IMPORTANT NOTES:

Creating the Agent Packager from the CLI

To create the agent packager from the CLI, do the following:

cfy-ap -h

Script to run the Cloudify Agent Packager via command line

Usage:
    cfy-ap [--config=<path> --force --dryrun --no-validation -v]
    cfy-ap --version

Options:
    -h --help                   Show this screen
    -c --config=<path>          Path to config yaml (defaults to config.yaml)
    -f --force                  Forces deletion and creation of venv and tar file.
    -d --dryrun                 Lists the modules to be installed without actually installing them.
    -n --no-validation          Does not validate that all modules were installed correctly.
    -v --verbose                Verbose level logging
    --version                   Displays current version

example:

cfy-ap -f -c my_config.yaml -v

Creating the Agent Packager from Python

To create the agent packager from Python, do the following:

import agent_packager.packager as cfyap

config = {}  # dict containing the configuration as given in the yaml file.

cfyap.create(config=config,
             config_file=None,
             force=False,
             dryrun=False,
             no_validate=False,
             verbose=True)

The cloudify-agent Module

See here.

Using the Agent

After creating the agent you can do one of the following:

Use the Agent on a Per-Node Basis

You can define the paths to the agent TAR file in a blueprint on a per-node basis. See the Cloudify Agent documentation for more information.

Install Agents in Cloudify Manager during Bootstrap

You can provide URLs for agents that you want to provide during Cloudify Manager bootstrap.

Configuring the Tool

The YAML Configuration File

Following is an example configuration file.

distribution: Ubuntu
release: trusty
python_path: '/usr/bin/python'
requirements_file: path/to/my/requirements/file.txt
cloudify_agent_version: master
cloudify_agent_module: http://github.com/cloudify-cosmo/cloudify-agent/archive/master.tar.gz
core_modules:
    cloudify_plugins_common: http://github.com/cloudify-cosmo/cloudify-plugins-common/archive/master.tar.gz
    cloudify_rest_client: http://github.com/cloudify-cosmo/cloudify-rest-client/archive/master.tar.gz
core_plugins:
    cloudify_script_plugin: http://github.com/cloudify-cosmo/cloudify-script-plugin/archive/master.tar.gz
additional_modules:
    - pyyaml==3.12
additional_plugins:
    cloudify_fabric_plugin: http://github.com/cloudify-cosmo/cloudify-fabric-plugin/archive/master.tar.gz
output_tar: Ubuntu-trusty-agent.tar.gz
keep_virtualenv: true

Explanation of the Configuration YAML File

Agent Modules

Each agent contains a set of Python packages. These modules can be either simple Python libraries, or plugins.

Core External Modules:

These are modules, which are not developed by Cloudify, that are used by the agent.

Core Modules

These modules are developed by Cloudify and provide core functionality for the agent. The default agents provided with Cloudify come with these modules pre-installed.

Core Plugins

These plugins are developed by Cloudify and provide core functionality for the agent. The default agents provided with Cloudify come with these modules pre-installed.

The Cloudify Manager also runs an instance of an agent, which is called the cloudify_management_agent. This agent is responsible for starting all other agents, and therefore requires the following plugin.