salt.cloud.clouds.linode

Linode Cloud Module using Linode's REST API

The Linode cloud module is used to control access to the Linode VPS system.

Use of this module only requires the apikey parameter. However, the default root password for new instances also needs to be set. The password needs to be 8 characters and contain lowercase, uppercase, and numbers.

Set up the cloud configuration at /etc/salt/cloud.providers or /etc/salt/cloud.providers.d/linode.conf:

my-linode-provider:
  apikey: f4ZsmwtB1c7f85Jdu43RgXVDFlNjuJaeIYV8QMftTqKScEB2vSosFSr...
  password: F00barbaz
  driver: linode

linode-profile:
  provider: my-linode-provider
  size: Linode 1024
  image: CentOS 7
  location: London, England, UK
salt.cloud.clouds.linode.avail_images(call=None)

Return available Linode images.

CLI Example:

salt-cloud --list-images my-linode-config
salt-cloud -f avail_images my-linode-config
salt.cloud.clouds.linode.avail_locations(call=None)

Return available Linode datacenter locations.

CLI Example:

salt-cloud --list-locations my-linode-config
salt-cloud -f avail_locations my-linode-config
salt.cloud.clouds.linode.avail_sizes(call=None)

Return available Linode sizes.

CLI Example:

salt-cloud --list-sizes my-linode-config
salt-cloud -f avail_sizes my-linode-config
salt.cloud.clouds.linode.boot(name=None, kwargs=None, call=None)

Boot a Linode.

name
The name of the Linode to boot. Can be used instead of linode_id.
linode_id
The ID of the Linode to boot. If provided, will be used as an alternative to name and reduces the number of API calls to Linode by one. Will be preferred over name.
config_id
The ID of the Config to boot. Required.
check_running
Defaults to True. If set to False, overrides the call to check if the VM is running before calling the linode.boot API call. Change check_running to True is useful during the boot call in the create function, since the new VM will not be running yet.

Can be called as an action (which requires a name):

salt-cloud -a boot my-instance config_id=10

...or as a function (which requires either a name or linode_id):

salt-cloud -f boot my-linode-config name=my-instance config_id=10
salt-cloud -f boot my-linode-config linode_id=1225876 config_id=10
salt.cloud.clouds.linode.clone(kwargs=None, call=None)

Clone a Linode.

linode_id
The ID of the Linode to clone. Required.
datacenter_id
The ID of the Datacenter where the Linode will be placed. Required.
plan_id
The ID of the plan (size) of the Linode. Required.

CLI Example:

salt-cloud -f clone my-linode-config linode_id=1234567 datacenter_id=2 plan_id=5
salt.cloud.clouds.linode.create(vm_)

Create a single Linode VM.

salt.cloud.clouds.linode.create_config(kwargs=None, call=None)

Creates a Linode Configuration Profile.

name
The name of the VM to create the config for.
linode_id
The ID of the Linode to create the configuration for.
root_disk_id
The Root Disk ID to be used for this config.
swap_disk_id
The Swap Disk ID to be used for this config.
data_disk_id
The Data Disk ID to be used for this config.

2016.3.0 新版功能.

kernel_id
The ID of the kernel to use for this configuration profile.
salt.cloud.clouds.linode.create_data_disk(vm_=None, linode_id=None, data_size=None)

Create a data disk for the linode (type is hardcoded to ext4 at the moment)

2016.3.0 新版功能.

vm_
The VM profile to create the data disk for.
linode_id
The ID of the Linode to create the data disk for.
data_size
The size of the disk, in MB.
salt.cloud.clouds.linode.create_disk_from_distro(vm_, linode_id, swap_size=None)

Creates the disk for the Linode from the distribution.

vm_
The VM profile to create the disk for.
linode_id
The ID of the Linode to create the distribution disk for. Required.
swap_size
The size of the disk, in MB.
salt.cloud.clouds.linode.create_private_ip(linode_id)

Creates a private IP for the specified Linode.

linode_id
The ID of the Linode to create the IP address for.
salt.cloud.clouds.linode.create_swap_disk(vm_, linode_id, swap_size=None)

Creates the disk for the specified Linode.

vm_
The VM profile to create the swap disk for.
linode_id
The ID of the Linode to create the swap disk for.
swap_size
The size of the disk, in MB.
salt.cloud.clouds.linode.destroy(name, call=None)

Destroys a Linode by name.

name
The name of VM to be be destroyed.

CLI Example:

salt-cloud -d vm_name
salt.cloud.clouds.linode.get_config_id(kwargs=None, call=None)

Returns a config_id for a given linode.

2015.8.0 新版功能.

name
The name of the Linode for which to get the config_id. Can be used instead of linode_id.h
linode_id
The ID of the Linode for which to get the config_id. Can be used instead of name.

CLI Example:

salt-cloud -f get_config_id my-linode-config name=my-linode
salt-cloud -f get_config_id my-linode-config linode_id=1234567
salt.cloud.clouds.linode.get_configured_provider()

Return the first configured instance.

salt.cloud.clouds.linode.get_data_disk(vm_)

Return True if a data disk is requested

2016.3.0 新版功能.

salt.cloud.clouds.linode.get_data_disk_size(vm_, swap, linode_id)

Return the size of of the data disk in MB

2016.3.0 新版功能.

salt.cloud.clouds.linode.get_datacenter_id(location)

Returns the Linode Datacenter ID.

location
The location, or name, of the datacenter to get the ID from.
salt.cloud.clouds.linode.get_disk_size(vm_, swap, linode_id)

Returns the size of of the root disk in MB.

vm_
The VM to get the disk size for.
salt.cloud.clouds.linode.get_distribution_id(vm_)

Returns the distribution ID for a VM

vm_
The VM to get the distribution ID for
salt.cloud.clouds.linode.get_ips(linode_id=None)

Returns public and private IP addresses.

linode_id
Limits the IP addresses returned to the specified Linode ID.
salt.cloud.clouds.linode.get_linode(kwargs=None, call=None)

Returns data for a single named Linode.

name
The name of the Linode for which to get data. Can be used instead linode_id. Note this will induce an additional API call compared to using linode_id.
linode_id
The ID of the Linode for which to get data. Can be used instead of name.

CLI Example:

salt-cloud -f get_linode my-linode-config name=my-instance
salt-cloud -f get_linode my-linode-config linode_id=1234567
salt.cloud.clouds.linode.get_linode_id_from_name(name)

Returns the Linode ID for a VM from the provided name.

name
The name of the Linode from which to get the Linode ID. Required.
salt.cloud.clouds.linode.get_password(vm_)

Return the password to use for a VM.

vm_
The configuration to obtain the password from.
salt.cloud.clouds.linode.get_plan_id(kwargs=None, call=None)

Returns the Linode Plan ID.

label
The label, or name, of the plan to get the ID from.

CLI Example:

salt-cloud -f get_plan_id linode label="Linode 1024"
salt.cloud.clouds.linode.get_private_ip(vm_)

Return True if a private ip address is requested

salt.cloud.clouds.linode.get_pub_key(vm_)

Return the SSH pubkey.

vm_
The configuration to obtain the public key from.
salt.cloud.clouds.linode.get_swap_size(vm_)

Returns the amoutn of swap space to be used in MB.

vm_
The VM profile to obtain the swap size from.
salt.cloud.clouds.linode.get_vm_size(vm_)

Returns the VM's size.

vm_
The VM to get the size for.
salt.cloud.clouds.linode.list_nodes(call=None)

Returns a list of linodes, keeping only a brief listing.

CLI Example:

salt-cloud -Q
salt-cloud --query
salt-cloud -f list_nodes my-linode-config

注解

The image label only displays information about the VM's distribution vendor, such as "Debian" or "RHEL" and does not display the actual image name. This is due to a limitation of the Linode API.

salt.cloud.clouds.linode.list_nodes_full(call=None)

List linodes, with all available information.

CLI Example:

salt-cloud -F
salt-cloud --full-query
salt-cloud -f list_nodes_full my-linode-config

注解

The image label only displays information about the VM's distribution vendor, such as "Debian" or "RHEL" and does not display the actual image name. This is due to a limitation of the Linode API.

salt.cloud.clouds.linode.list_nodes_min(call=None)

Return a list of the VMs that are on the provider. Only a list of VM names and their state is returned. This is the minimum amount of information needed to check for existing VMs.

2015.8.0 新版功能.

CLI Example:

salt-cloud -f list_nodes_min my-linode-config
salt-cloud --function list_nodes_min my-linode-config
salt.cloud.clouds.linode.list_nodes_select(call=None)

Return a list of the VMs that are on the provider, with select fields.

salt.cloud.clouds.linode.reboot(name, call=None)

Reboot a linode.

2015.8.0 新版功能.

name
The name of the VM to reboot.

CLI Example:

salt-cloud -a reboot vm_name
salt.cloud.clouds.linode.show_instance(name, call=None)

Displays details about a particular Linode VM. Either a name or a linode_id must be provided.

2015.8.0 新版功能.

name
The name of the VM for which to display details.

CLI Example:

salt-cloud -a show_instance vm_name

注解

The image label only displays information about the VM's distribution vendor, such as "Debian" or "RHEL" and does not display the actual image name. This is due to a limitation of the Linode API.

salt.cloud.clouds.linode.show_pricing(kwargs=None, call=None)

Show pricing for a particular profile. This is only an estimate, based on unofficial pricing sources.

2015.8.0 新版功能.

CLI Example:

salt-cloud -f show_pricing my-linode-config profile=my-linode-profile
salt.cloud.clouds.linode.start(name, call=None)

Start a VM in Linode.

name
The name of the VM to start.

CLI Example:

salt-cloud -a stop vm_name
salt.cloud.clouds.linode.stop(name, call=None)

Stop a VM in Linode.

name
The name of the VM to stop.

CLI Example:

salt-cloud -a stop vm_name
salt.cloud.clouds.linode.update_linode(linode_id, update_args=None)

Updates a Linode's properties.

linode_id
The ID of the Linode to shutdown. Required.
update_args
The args to update the Linode with. Must be in dictionary form.