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 >= 3.1.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 server size.
  size: Micro Instance
  # Assign CPU family to server.
  cpu_family: INTEL_XEON
  # Number of CPU cores to allocate to node (overrides server size).
  cores: 4
  # Amount of RAM in multiples of 256 MB (overrides server size).
  ram: 4096
  # The server availability zone.
  availability_zone: ZONE_1
  # Name or UUID of the HDD image to use.
  image: <UUID>
  # Size of the node disk in GB (overrides server size).
  disk_size: 40
  # Type of disk (HDD or SSD).
  disk_type: SSD
  # Storage availability zone to use.
  disk_availability_zone: ZONE_2
  # Assign the server to the specified public LAN.
  public_lan: <ID>
  # Assign firewall rules to the network interface.
  public_firewall_rules:
    SSH:
      protocol: TCP
      port_range_start: 22
      port_range_end: 22
  # Assign the server to the specified private LAN.
  private_lan: <ID>
  # Enable NAT on the private NIC.
  nat: true
  # Assign additional volumes to the server.
  volumes:
    data-volume:
      disk_size: 500
      disk_availability_zone: ZONE_3
    log-volume:
      disk_size: 50
      disk_type: SSD

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_datacenter(call=None, kwargs=None)

Creates a virtual datacenter based on supplied parameters.

CLI Example:

salt-cloud -f create_datacenter profitbricks name=mydatacenter location=us/las description="my description"
salt.cloud.clouds.profitbricks.create_loadbalancer(call=None, kwargs=None)

Creates a loadbalancer within the datacenter from the provider config.

CLI Example:

salt-cloud -f create_loadbalancer profitbricks name=mylb
salt.cloud.clouds.profitbricks.destroy(name, call=None)

destroy a machine by name

Parameters:
  • name -- name given to the machine
  • call -- call value in this case is 'action'
Returns:

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_disk_type(vm_)

Return the type of disk to use. Either 'HDD' (default) or 'SSD'.

salt.cloud.clouds.profitbricks.get_image(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.get_wait_timeout(vm_)

Return the wait_for_timeout for resource provisioning.

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_loadbalancers(call=None)

Return a list of the loadbalancers that are on the provider

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.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(lan_id)

Enables public Internet access for the specified public_lan. If no public LAN is available, then a new public LAN is created.

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