community.general.profitbricks (8.5.0) — module

Create, destroy, start, stop, and reboot a ProfitBricks virtual machine

Authors: Matt Baldwin (@baldwinSPC) <baldwin@stackpointcloud.com>

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Create, destroy, update, start, stop, and reboot a ProfitBricks virtual machine. When the virtual machine is created it can optionally wait for it to be 'running' before returning. This module has a dependency on profitbricks >= 1.0.0


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# Note: These examples do not set authentication details, see the AWS Guide for details.

# Provisioning example
- name: Create three servers and enumerate their names
  community.general.profitbricks:
    datacenter: Tardis One
    name: web%02d.stackpointcloud.com
    cores: 4
    ram: 2048
    volume_size: 50
    cpu_family: INTEL_XEON
    image: a3eae284-a2fe-11e4-b187-5f1f641608c8
    location: us/las
    count: 3
    assign_public_ip: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove virtual machines
  community.general.profitbricks:
    datacenter: Tardis One
    instance_ids:
      - 'web001.stackpointcloud.com'
      - 'web002.stackpointcloud.com'
      - 'web003.stackpointcloud.com'
    wait_timeout: 500
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Start virtual machines
  community.general.profitbricks:
    datacenter: Tardis One
    instance_ids:
      - 'web001.stackpointcloud.com'
      - 'web002.stackpointcloud.com'
      - 'web003.stackpointcloud.com'
    wait_timeout: 500
    state: running
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Stop virtual machines
  community.general.profitbricks:
    datacenter: Tardis One
    instance_ids:
      - 'web001.stackpointcloud.com'
      - 'web002.stackpointcloud.com'
      - 'web003.stackpointcloud.com'
    wait_timeout: 500
    state: stopped

Inputs

    
bus:
    choices:
    - IDE
    - VIRTIO
    default: VIRTIO
    description:
    - The bus type for the volume.
    type: str

lan:
    default: 1
    description:
    - The ID of the LAN you wish to add the servers to.
    type: int

ram:
    default: 2048
    description:
    - The amount of memory to allocate to the virtual machine.
    type: int

name:
    description:
    - The name of the virtual machine.
    type: str

wait:
    default: true
    description:
    - wait for the instance to be in state 'running' before returning
    type: bool

cores:
    default: 2
    description:
    - The number of CPU cores to allocate to the virtual machine.
    type: int

count:
    default: 1
    description:
    - The number of virtual machines to create.
    type: int

image:
    description:
    - The system image ID for creating the virtual machine, e.g. a3eae284-a2fe-11e4-b187-5f1f641608c8.
    type: str

state:
    default: present
    description:
    - create or terminate instances
    - 'The choices available are: V(running), V(stopped), V(absent), V(present).'
    type: str

location:
    choices:
    - us/las
    - de/fra
    - de/fkb
    default: us/las
    description:
    - The datacenter location. Use only if you want to create the Datacenter or else this
      value is ignored.
    type: str

ssh_keys:
    default: []
    description:
    - Public SSH keys allowing access to the virtual machine.
    elements: str
    type: list

disk_type:
    choices:
    - SSD
    - HDD
    default: HDD
    description:
    - the type of disk to be allocated.
    type: str

cpu_family:
    choices:
    - AMD_OPTERON
    - INTEL_XEON
    default: AMD_OPTERON
    description:
    - The CPU family type to allocate to the virtual machine.
    type: str

datacenter:
    description:
    - The datacenter to provision this virtual machine.
    type: str

volume_size:
    default: 10
    description:
    - The size in GB of the boot volume.
    type: int

instance_ids:
    default: []
    description:
    - list of instance ids, currently only used when state='absent' to remove instances.
    elements: str
    type: list

wait_timeout:
    default: 600
    description:
    - how long before wait gives up, in seconds
    type: int

auto_increment:
    default: true
    description:
    - Whether or not to increment a single number in the name for created virtual machines.
    type: bool

image_password:
    description:
    - Password set for the administrative user.
    type: str

assign_public_ip:
    default: false
    description:
    - This will assign the machine to the public LAN. If no LAN exists with public Internet
      access it is created.
    type: bool

subscription_user:
    description:
    - The ProfitBricks username. Overrides the PB_SUBSCRIPTION_ID environment variable.
    type: str

remove_boot_volume:
    default: true
    description:
    - remove the bootVolume of the virtual machine you're destroying.
    type: bool

subscription_password:
    description:
    - THe ProfitBricks password. Overrides the PB_PASSWORD environment variable.
    type: str