community.general.rax module – Create / delete an instance in Rackspace Public Cloud
Note
This module is part of the community.general collection (version 7.5.2).
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
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.rax
.
DEPRECATED
- Removed in:
version 9.0.0
- Why:
This module relies on the deprecated package pyrax.
- Alternative:
Use the Openstack modules instead.
Synopsis
creates / deletes a Rackspace Public Cloud instance and optionally waits for it to be ‘running’.
Aliases: cloud.rackspace.rax
Requirements
The below requirements are needed on the host that executes this module.
python >= 2.6
pyrax
Parameters
Parameter |
Comments |
---|---|
Rackspace API key, overrides |
|
The URI of the authentication service. If not specified will be set to https://identity.api.rackspacecloud.com/v2.0/ |
|
Whether or not to increment a single number with the name of the created servers. Only applicable when used with the Choices:
|
|
Whether or not to boot the instance from a Cloud Block Storage volume. If Choices:
|
|
Cloud Block Storage ID or Name to use as the boot volume of the instance |
|
Size of the volume to create in Gigabytes. This is only required with Default: |
|
Whether the Choices:
|
|
Attach read-only configuration drive to server as label config-2 Choices:
|
|
number of instances to launch Default: |
|
number count to start at Default: |
|
Disk partitioning strategy If not specified it will assume the value Choices:
|
|
Environment as configured in |
|
Explicitly ensure an exact count of instances, used with state=active/present. If specified as Choices:
|
|
A hash of key/value pairs to be used when creating the cloudservers client. This is considered an advanced option, use it wisely and with caution. Default: |
|
A hash of key/value pairs to be used when creating a new server. This is considered an advanced option, use it wisely and with caution. Default: |
|
Files to insert into the instance. remotefilename:localcontent Default: |
|
flavor to use for the instance |
|
host group to assign to server, is also used for idempotent operations to ensure a specific number of instances |
|
Authentication mechanism to use, such as rackspace or keystone. Default: |
|
image to use for the instance. Can be an |
|
list of instance ids, currently only used when state=’absent’ to remove instances |
|
key pair to use on the instance |
|
A hash of metadata to associate with the instance Default: |
|
Name to give the instance |
|
The network to attach to the instances. If specified, you must include ALL networks including the public and private interfaces. Can be Default: |
|
Region to create an instance in. |
|
Indicate desired state of the resource Choices:
|
|
The tenant ID used for authentication. |
|
The tenant name used for authentication. |
|
Data to be uploaded to the servers config drive. This option implies |
|
Rackspace username, overrides |
|
Whether or not to require SSL validation of API endpoints. Choices:
|
|
wait for the instance to be in state ‘running’ before returning Choices:
|
|
how long before wait gives up, in seconds Default: |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: none |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Notes
Note
exact_count
can be “destructive” if the number of running servers in thegroup
is larger than that specified incount
. In such a case, thestate
is effectively set toabsent
and the extra servers are deleted. In the case of deletion, the returned data structure will haveaction
set todelete
, and the oldest servers in the group will be deleted.The following environment variables can be used,
RAX_USERNAME
,RAX_API_KEY
,RAX_CREDS_FILE
,RAX_CREDENTIALS
,RAX_REGION
.RAX_CREDENTIALS
andRAX_CREDS_FILE
points to a credentials file appropriate for pyrax. See https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticatingRAX_USERNAME
andRAX_API_KEY
obviate the use of a credentials fileRAX_REGION
defines a Rackspace Public Cloud region (DFW, ORD, LON, …)
Examples
- name: Build a Cloud Server
gather_facts: false
tasks:
- name: Server build request
local_action:
module: rax
credentials: ~/.raxpub
name: rax-test1
flavor: 5
image: b11d9567-e412-4255-96b9-bd63ab23bcfe
key_name: my_rackspace_key
files:
/root/test.txt: /home/localuser/test.txt
wait: true
state: present
networks:
- private
- public
register: rax
- name: Build an exact count of cloud servers with incremented names
hosts: local
gather_facts: false
tasks:
- name: Server build requests
local_action:
module: rax
credentials: ~/.raxpub
name: test%03d.example.org
flavor: performance1-1
image: ubuntu-1204-lts-precise-pangolin
state: present
count: 10
count_offset: 10
exact_count: true
group: test
wait: true
register: rax
Status
This module will be removed in version 9.0.0. [deprecated]
For more information see DEPRECATED.