The Joyent Cloud module is used to interact with the Joyent cloud system.
Set up the cloud configuration at /etc/salt/cloud.providers
or
/etc/salt/cloud.providers.d/joyent.conf
:
my-joyent-config:
driver: joyent
# The Joyent login user
user: fred
# The Joyent user's password
password: saltybacon
# The location of the ssh private key that can log into the new VM
private_key: /root/mykey.pem
# The name of the private key
keyname: mykey
When creating your profiles for the joyent cloud, add the location attribute to the profile, this will automatically get picked up when performing tasks associated with that vm. An example profile might look like:
joyent_512:
provider: my-joyent-config
size: g4-highcpu-512M
image: centos-6
location: us-east-1
This driver can also be used with the Joyent SmartDataCenter project. More details can be found at:
Using SDC requires that an api_host_suffix is set. The default value for this is .api.joyentcloud.com. All characters, including the leading ., should be included:
api_host_suffix: .api.myhostname.com
PyCrypto
Get list of available images
CLI Example:
salt-cloud --list-images
Can use a custom URL for images. Default is:
image_url: images.joyent.com/images
List all available locations
get list of available packages
CLI Example:
salt-cloud --list-sizes
Create a single VM from a data dict
CLI Example:
salt-cloud -p profile_name vm_name
convenience function to make the rest api call for node creation.
List the keys available
CLI Example:
salt-cloud -f delete_key joyent keyname=mykey
destroy a machine by name
name -- name given to the machine
call -- call value in this case is 'action'
array of booleans , true if successfully stopped and true if successfully removed
CLI Example:
salt-cloud -d vm_name
Return the first configured instance.
Return the image object to use
CLI parameter
VM parameter
Cloud profile setting
create url from location variable :param location: joyent data center location :return: url
gets the node from the full node list by name :param name: name of the vm :return: node object
Return the VM's size object
Find if the provided object has a specific method
List the keys available
CLI Example:
salt-cloud -f import_key joyent keyname=mykey keyfile=/tmp/mykey.pub
Convert joyent returned state to state common to other data center return values for consistency
id -- joyent state value
state value
convert list to dictionary using the key as the identifier :param items: array to iterate over :return: dictionary
List the keys available
list of nodes, keeping only a brief listing
CLI Example:
salt-cloud -Q
list of nodes, maintaining all content provided from joyent listings
CLI Example:
salt-cloud -F
Return a list of the VMs that are on the provider, with select fields
Make a web call to Joyent
Query an instance upon creation from the Joyent API
reboot a machine by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful
CLI Example:
salt-cloud -a reboot vm_name
Reformat the returned data from joyent, determine public/private IPs and strip out fields if necessary to provide either full or brief content.
item -- node dictionary
full -- full or brief output
dict
get details about a machine :param name: name given to the machine :param call: call value in this case is 'action' :return: machine information
CLI Example:
salt-cloud -a show_instance vm_name
List the keys available
Return the ssh_interface type to connect to. Either 'public_ips' (default) or 'private_ips'.
start a machine by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful
CLI Example:
salt-cloud -a start vm_name
stop a machine by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful
CLI Example:
salt-cloud -a stop vm_name
take action call used by start,stop, reboot :param name: name given to the machine :param call: call value in this case is 'action' :command: api path :data: any data to be passed to the api, must be in json format :method: GET,POST,or DELETE :location: data center to execute the command on :return: true if successful