The Linode cloud module is used to interact with the Linode Cloud.
You can target a specific version of the Linode API with the api_version parameter. The default is v3.
The following provider parameters are supported:
v3.500.0.Note
APIv3 usage is deprecated and will be removed in a future release in favor of APIv4. To move to APIv4 now,
set the api_version parameter in your provider configuration to v4. See the full migration guide
here https://docs.saltproject.io/en/latest/topics/cloud/linode.html#migrating-to-apiv4.
Set up the provider configuration at /etc/salt/cloud.providers or /etc/salt/cloud.providers.d/linode.conf:
my-linode-provider:
driver: linode
api_version: v4
apikey: f4ZsmwtB1c7f85Jdu43RgXVDFlNjuJaeIYV8QMftTqKScEB2vSosFSr...
password: F00barbaz
For use with APIv3 (deprecated):
my-linode-provider-v3:
driver: linode
apikey: f4ZsmwtB1c7f85Jdu43RgXVDFlNjuJaeIYV8QMftTqKScEB2vSosFSr...
password: F00barbaz
The following profile parameters are supported:
g6-standard-2). For APIv3, this would be a plan ID (i.e. Linode 2GB). Run salt-cloud -f avail_sizes my-linode-provider for options.us-east). For APIv3, this would be a datacenter location (i.e. Newark, NJ, USA). Run salt-cloud -f avail_locations my-linode-provider for options.linode/ubuntu16.04); official images start with linode/. For APIv3, this would be an image label (i.e. Ubuntu 16.04). Run salt-cloud -f avail_images my-linode-provider for more options.False.private_ips or public_ips. Defaults to public_ips.256.Set up a profile configuration in /etc/salt/cloud.profiles.d/:
my-linode-profile:
# a minimal configuration
provider: my-linode-provider
size: g6-standard-1
image: linode/alpine3.12
location: us-east
my-linode-profile-advanced:
# an advanced configuration
provider: my-linode-provider
size: g6-standard-3
image: linode/alpine3.10
location: eu-west
password: bogus123X
assign_private_ip: true
ssh_interface: private_ips
ssh_pubkey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB...
swap_size: 512
my-linode-profile-v3:
# a legacy configuration
provider: my-linode-provider-v3
size: Nanode 1GB
image: Alpine 3.12
location: Fremont, CA, USA
In order to target APIv4, ensure your provider configuration has api_version set to v4.
You will also need to generate a new token for your account. See https://www.linode.com/docs/platform/api/getting-started-with-the-linode-api/#create-an-api-token
There are a few changes to note:
- There has been a general move from label references to ID references. The profile configuration parameters location, size, and image have moved from being label based references to IDs. See the profile section for more information. In addition to these inputs being changed, avail_sizes, avail_locations, and avail_images now output options sorted by ID instead of label.
- The disk_size profile configuration parameter has been deprecated and will not be taken into account when creating new VMs while targeting APIv4.
| maintainer: | Charles Kenney <ckenney@linode.com> |
|---|---|
| maintainer: | Phillip Campbell <pcampbell@linode.com> |
| depends: | requests |
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.
linode_id.name and reduces the number of API calls to
Linode by one. Will be preferred over name.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.
location instead.size instead.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.
New in version 2016.3.0.
salt.cloud.clouds.linode.destroy(name, call=None)¶Destroys a Linode by name.
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.
New in version 2015.8.0.
linode_id.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_linode(kwargs=None, call=None)¶Returns data for a single named Linode.
linode_id. Note this will induce an additional API call
compared to using linode_id.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_plan_id(kwargs=None, call=None)¶Returns the Linode Plan ID.
CLI Example:
salt-cloud -f get_plan_id linode label="Nanode 1GB"
salt-cloud -f get_plan_id linode label="Linode 2GB"
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
Note
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
Note
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.
New in version 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.
New in version 2015.8.0.
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.
New in version 2015.8.0.
CLI Example:
salt-cloud -a show_instance vm_name
Note
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.
New in version 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.
CLI Example:
salt-cloud -a stop vm_name
salt.cloud.clouds.linode.stop(name, call=None)¶Stop a VM in Linode.
CLI Example:
salt-cloud -a stop vm_name
Docs for previous releases are available on readthedocs.org.
Latest Salt release: 3004.1