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.
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.
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.
2016.3.0 新版功能.
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 新版功能.
salt.cloud.clouds.linode.
create_disk_from_distro
(vm_, linode_id, swap_size=None)¶Creates the disk for the Linode from the distribution.
salt.cloud.clouds.linode.
create_private_ip
(linode_id)¶Creates a private IP for the specified Linode.
salt.cloud.clouds.linode.
create_swap_disk
(vm_, linode_id, swap_size=None)¶Creates the disk for the specified Linode.
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.
2015.8.0 新版功能.
linode_id
.hname
.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.
salt.cloud.clouds.linode.
get_disk_size
(vm_, swap, linode_id)¶Returns the size of of the root disk in MB.
salt.cloud.clouds.linode.
get_distribution_id
(vm_)¶Returns the distribution ID for a VM
salt.cloud.clouds.linode.
get_ips
(linode_id=None)¶Returns public and private IP addresses.
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_linode_id_from_name
(name)¶Returns the Linode ID for a VM from the provided name.
salt.cloud.clouds.linode.
get_password
(vm_)¶Return the password to use for a VM.
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="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.
salt.cloud.clouds.linode.
get_swap_size
(vm_)¶Returns the amoutn of swap space to be used in MB.
salt.cloud.clouds.linode.
get_vm_size
(vm_)¶Returns the VM's size.
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 新版功能.
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 新版功能.
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.
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
salt.cloud.clouds.linode.
update_linode
(linode_id, update_args=None)¶Updates a Linode's properties.