community / community.general / 8.5.0 / module / rax
Removed in 9.0.0
Reason:This module relies on the deprecated package pyrax. | Alternative:Use the Openstack modules instead.
Create / delete an instance in Rackspace Public Cloud
Authors: Jesse Keating (@omgjlk), Matt Martz (@sivel)
Install with ansible-galaxy collection install community.general:==8.5.0
collections: - name: community.general version: 8.5.0
creates / deletes a Rackspace Public Cloud instance and optionally waits for it to be 'running'.
- 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
env: description: - Environment as configured in C(~/.pyrax.cfg), see U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration). type: str meta: default: {} description: - A hash of metadata to associate with the instance type: dict name: description: - Name to give the instance type: str wait: default: false description: - wait for the instance to be in state 'running' before returning type: bool count: default: 1 description: - number of instances to launch type: int files: default: {} description: - Files to insert into the instance. remotefilename:localcontent type: dict group: description: - host group to assign to server, is also used for idempotent operations to ensure a specific number of instances type: str image: description: - image to use for the instance. Can be an C(id), C(human_id) or C(name). With O(boot_from_volume), a Cloud Block Storage volume will be created with this image type: str state: choices: - present - absent default: present description: - Indicate desired state of the resource type: str flavor: description: - flavor to use for the instance type: str region: description: - Region to create an instance in. type: str api_key: aliases: - password description: - Rackspace API key, overrides O(credentials). type: str key_name: aliases: - keypair description: - key pair to use on the instance type: str networks: default: - public - private description: - The network to attach to the instances. If specified, you must include ALL networks including the public and private interfaces. Can be C(id) or C(label). elements: str type: list username: description: - Rackspace username, overrides O(credentials). type: str tenant_id: description: - The tenant ID used for authentication. type: str user_data: description: - Data to be uploaded to the servers config drive. This option implies O(config_drive). Can be a file path or a string type: str boot_volume: description: - Cloud Block Storage ID or Name to use as the boot volume of the instance type: str credentials: aliases: - creds_file description: - File to find the Rackspace credentials in. Ignored if O(api_key) and O(username) are provided. type: path disk_config: choices: - auto - manual description: - Disk partitioning strategy - If not specified it will assume the value V(auto). type: str exact_count: default: false description: - Explicitly ensure an exact count of instances, used with state=active/present. If specified as V(true) and O(count) is less than the servers matched, servers will be deleted to match the count. If the number of matched servers is fewer than specified in O(count) additional servers will be added. type: bool tenant_name: description: - The tenant name used for authentication. type: str config_drive: default: false description: - Attach read-only configuration drive to server as label config-2 type: bool count_offset: default: 1 description: - number count to start at type: int instance_ids: description: - list of instance ids, currently only used when state='absent' to remove instances elements: str type: list wait_timeout: default: 300 description: - how long before wait gives up, in seconds type: int auth_endpoint: description: - The URI of the authentication service. - If not specified will be set to U(https://identity.api.rackspacecloud.com/v2.0/). type: str identity_type: default: rackspace description: - Authentication mechanism to use, such as rackspace or keystone. type: str auto_increment: default: true description: - Whether or not to increment a single number with the name of the created servers. Only applicable when used with the O(group) attribute or meta key. type: bool validate_certs: aliases: - verify_ssl description: - Whether or not to require SSL validation of API endpoints. type: bool boot_from_volume: default: false description: - Whether or not to boot the instance from a Cloud Block Storage volume. If V(true) and O(image) is specified a new volume will be created at boot time. O(boot_volume_size) is required with O(image) to create a new volume at boot time. type: bool boot_volume_size: default: 100 description: - Size of the volume to create in Gigabytes. This is only required with O(image) and O(boot_from_volume). type: int extra_client_args: default: {} description: - 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. type: dict extra_create_args: default: {} description: - 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. type: dict boot_volume_terminate: default: false description: - Whether the O(boot_volume) or newly created volume from O(image) will be terminated when the server is terminated type: bool