salt.cloud.clouds.profitbricks

ProfitBricks Cloud Module

The ProfitBricks SaltStack cloud module allows a ProfitBricks server to be automatically deployed and bootstraped with Salt.

depends:profitbrick >= 2.3.0

The module requires ProfitBricks credentials to be supplied along with an existing virtual datacenter UUID where the server resources will reside. The server should also be assigned a public LAN, a private LAN, or both along with SSH key pairs. ...

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

my-profitbricks-config:
  driver: profitbricks
  # The ProfitBricks login username
  username: user@example.com
  # The ProfitBricks login password
  password: secretpassword
  # The ProfitBricks virtual datacenter UUID
  datacenter_id: <UUID>
  # SSH private key filename
  ssh_private_key: /path/to/private.key
  # SSH public key filename
  ssh_public_key: /path/to/public.key
my-profitbricks-profile:
  provider: my-profitbricks-config
  # Name of a predefined instance size.
  size: Micro Instance
  # Name or UUID of the HDD image to use.
  image: <UUID>
  # Size of the node disk in GB (overrides instance size).
  disk_size: 40
  # Number of CPU cores to allocate to node (overrides instance size).
  cores: 4
  # Amount of RAM in multiples of 256 MB (overrides instance size).
  ram: 4096
  # Assign the node to the specified public LAN.
  public_lan: <ID>
  # Assign the node to the specified private LAN.
  private_lan: <ID>

To use a private IP for connecting and bootstrapping node:

my-profitbricks-profile:
  ssh_interface: private_lan

Set deploy to False if Salt should not be installed on the node.

my-profitbricks-profile:
  deploy: False
salt.cloud.clouds.profitbricks.avail_images(call=None)

Return a list of the images that are on the provider

salt.cloud.clouds.profitbricks.avail_sizes(call=None)

Return a dict of all available VM sizes on the cloud provider with relevant data. Latest version can be found at:

salt.cloud.clouds.profitbricks.create(vm_)

Create a single VM from a data dict

salt.cloud.clouds.profitbricks.create_network_interfaces(conn, datacenter_id, server_id, vm_)

Create network interface on appropriate LAN as defined in cloud profile.

salt.cloud.clouds.profitbricks.destroy(name, call=None)

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
salt.cloud.clouds.profitbricks.get_configured_provider()

Return the first configured instance.

salt.cloud.clouds.profitbricks.get_conn()

Return a conn object for the passed VM data

salt.cloud.clouds.profitbricks.get_datacenter(conn)

Return the datacenter from the config provider datacenter ID

salt.cloud.clouds.profitbricks.get_datacenter_id()

Return datacenter ID from provider configuration

salt.cloud.clouds.profitbricks.get_dependencies()

Warn if dependencies are not met.

salt.cloud.clouds.profitbricks.get_image(conn, vm_)

Return the image object to use

salt.cloud.clouds.profitbricks.get_key_filename(vm_)

Check SSH private key file and return absolute path if exists.

salt.cloud.clouds.profitbricks.get_node(conn, name)

Return a node for the named VM

salt.cloud.clouds.profitbricks.get_public_keys(vm_)

Retrieve list of SSH public keys.

salt.cloud.clouds.profitbricks.get_size(vm_)

Return the VM's size object

salt.cloud.clouds.profitbricks.list_datacenters(conn=None, call=None)

List all the data centers

CLI Example:

salt-cloud -f list_datacenters my-profitbricks-config
salt.cloud.clouds.profitbricks.list_nodes(conn=None, call=None)

Return a list of VMs that are on the provider

salt.cloud.clouds.profitbricks.list_nodes_full(conn=None, call=None)

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

salt.cloud.clouds.profitbricks.override_size(vm_)

Apply any extra component overrides to VM from the cloud profile.

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

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
salt.cloud.clouds.profitbricks.set_public_lan(conn, vm_)

Enables public Internet access for the specified public_lan.

salt.cloud.clouds.profitbricks.show_instance(name, call=None)

Show the details from the provider concerning an instance

salt.cloud.clouds.profitbricks.ssh_interface(vm_)

Return the ssh_interface type to connect to. Either 'public_ips' (default) or 'private_ips'.

salt.cloud.clouds.profitbricks.start(name, call=None)

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
salt.cloud.clouds.profitbricks.stop(name, call=None)

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