W3cubDocs

/Ansible

community.general.profitbricks – Create, destroy, start, stop, and reboot a ProfitBricks virtual machine.

Note

This plugin is part of the community.general collection (version 3.8.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.profitbricks.

Synopsis

  • 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

The below requirements are needed on the host that executes this module.

  • profitbricks
  • python >= 2.6

Parameters

Parameter Choices/Defaults Comments
assign_public_ip
boolean
    Choices:
  • no
  • yes
This will assign the machine to the public LAN. If no LAN exists with public Internet access it is created.
auto_increment
boolean
    Choices:
  • no
  • yes
Whether or not to increment a single number in the name for created virtual machines.
bus
string
    Choices:
  • IDE
  • VIRTIO
The bus type for the volume.
cores
integer
Default:
2
The number of CPU cores to allocate to the virtual machine.
count
integer
Default:
1
The number of virtual machines to create.
cpu_family
string
    Choices:
  • AMD_OPTERON
  • INTEL_XEON
The CPU family type to allocate to the virtual machine.
datacenter
string
The datacenter to provision this virtual machine.
disk_type
string
    Choices:
  • SSD
  • HDD
the type of disk to be allocated.
image
string
The system image ID for creating the virtual machine, e.g. a3eae284-a2fe-11e4-b187-5f1f641608c8.
image_password
string
Password set for the administrative user.
instance_ids
list / elements=string
list of instance ids, currently only used when state='absent' to remove instances.
lan
integer
Default:
1
The ID of the LAN you wish to add the servers to.
location
string
    Choices:
  • us/las
  • de/fra
  • de/fkb
The datacenter location. Use only if you want to create the Datacenter or else this value is ignored.
name
string
The name of the virtual machine.
ram
integer
Default:
2048
The amount of memory to allocate to the virtual machine.
remove_boot_volume
boolean
    Choices:
  • no
  • yes
remove the bootVolume of the virtual machine you're destroying.
ssh_keys
list / elements=string
Public SSH keys allowing access to the virtual machine.
state
string
Default:
"present"
create or terminate instances
The choices available are: running, stopped, absent, present.
subscription_password
string
THe ProfitBricks password. Overrides the PB_PASSWORD environment variable.
subscription_user
string
The ProfitBricks username. Overrides the PB_SUBSCRIPTION_ID environment variable.
volume_size
integer
Default:
10
The size in GB of the boot volume.
wait
boolean
    Choices:
  • no
  • yes
wait for the instance to be in state 'running' before returning
wait_timeout
integer
Default:
600
how long before wait gives up, in seconds

Examples

# 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

- 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

- 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

- 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

Authors

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/profitbricks_module.html