salt.modules.cloud

Salt-specific interface for calling Salt Cloud directly

salt.modules.cloud.action(fun=None, cloudmap=None, names=None, provider=None, instance=None, **kwargs)

Execute a single action on the given provider/instance

CLI 范例:

salt '*' cloud.action start instance=myinstance
salt '*' cloud.action stop instance=myinstance
salt '*' cloud.action show_image provider=my-ec2-config image=ami-1624987f
salt.modules.cloud.create(provider, names, **kwargs)

Create an instance using Salt Cloud

CLI 范例:

salt minionname cloud.create my-ec2-config myinstance image=ami-1624987f size='t1.micro' ssh_username=ec2-user securitygroup=default delvol_on_destroy=True
salt.modules.cloud.destroy(names)

Destroy the named VM(s)

CLI 范例:

salt '*' cloud.destroy myinstance
salt.modules.cloud.full_query(query_type='list_nodes_full')

List all available cloud provider data

CLI 范例:

salt '*' cloud.full_query
salt.modules.cloud.get_instance(name, provider=None)

Return details on an instance.

Similar to the cloud action show_instance but returns only the instance details.

CLI 范例:

salt '*' cloud.get_instance myinstance

SLS Example:

{{ salt['cloud.get_instance']('myinstance')['mac_address'] }}
salt.modules.cloud.has_instance(name, provider=None)

Return true if the instance is found on a provider

CLI 范例:

salt '*' cloud.has_instance myinstance
salt.modules.cloud.list_images(provider='all')

List cloud provider images for the given providers

CLI 范例:

salt '*' cloud.list_images my-gce-config
salt.modules.cloud.list_locations(provider='all')

List cloud provider locations for the given providers

CLI 范例:

salt '*' cloud.list_locations my-gce-config
salt.modules.cloud.list_sizes(provider='all')

List cloud provider sizes for the given providers

CLI 范例:

salt '*' cloud.list_sizes my-gce-config
salt.modules.cloud.network_create(provider, names, **kwargs)

Create private network

CLI 范例:

salt minionname cloud.network_create my-nova names=['salt'] cidr='192.168.100.0/24'
salt.modules.cloud.network_list(provider)

List private networks

CLI 范例:

salt minionname cloud.network_list my-nova
salt.modules.cloud.profile(profile, names, vm_overrides=None, **kwargs)

Spin up an instance using Salt Cloud

CLI 范例:

salt '*' cloud.profile my-gce-config myinstance
salt.modules.cloud.query(query_type='list_nodes')

List cloud provider data for all providers

CLI范例:

salt '*' cloud.query
salt '*' cloud.query list_nodes_full
salt '*' cloud.query list_nodes_select
salt.modules.cloud.select_query(query_type='list_nodes_select')

List selected nodes

CLI 范例:

salt '*' cloud.select_query
salt.modules.cloud.virtual_interface_create(provider, names, **kwargs)

Attach private interfaces to a server

CLI 范例:

salt minionname cloud.virtual_interface_create my-nova names=['salt-master'] net_name='salt'
salt.modules.cloud.virtual_interface_list(provider, names, **kwargs)

List virtual interfaces on a server

CLI 范例:

salt minionname cloud.virtual_interface_list my-nova names=['salt-master']
salt.modules.cloud.volume_attach(provider, names, **kwargs)

Attach volume to a server

CLI 范例:

salt minionname cloud.volume_attach my-nova myblock server_name=myserver device='/dev/xvdf'
salt.modules.cloud.volume_create(provider, names, **kwargs)

Create volume

CLI 范例:

salt minionname cloud.volume_create my-nova myblock size=100 voltype=SSD
salt.modules.cloud.volume_delete(provider, names, **kwargs)

Delete volume

CLI 范例:

salt minionname cloud.volume_delete my-nova myblock
salt.modules.cloud.volume_detach(provider, names, **kwargs)

Detach volume from a server

CLI 范例:

salt minionname cloud.volume_detach my-nova myblock server_name=myserver
salt.modules.cloud.volume_list(provider)

List block storage volumes

CLI 范例:

salt minionname cloud.volume_list my-nova