rax – create / delete an instance in Rackspace Public Cloud¶
Synopsis¶
creates / deletes a Rackspace Public Cloud instance and optionally waits for it to be ‘running’.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.6
pyrax
Parameters¶
Notes¶
Note
exact_count can be “destructive” if the number of running servers in the group is larger than that specified in count. In such a case, the state is effectively set to
absentand the extra servers are deleted. In the case of deletion, the returned data structure will haveactionset 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_CREDENTIALSandRAX_CREDS_FILEpoints to a credentials file appropriate for pyrax. See https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticatingRAX_USERNAMEandRAX_API_KEYobviate the use of a credentials fileRAX_REGIONdefines 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: yes
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: yes
group: test
wait: yes
register: rax
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
Jesse Keating (@omgjlk)
Matt Martz (@sivel)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.