community.general.rax (0.1.1) — module

create / delete an instance in Rackspace Public Cloud

Authors: Jesse Keating (@omgjlk), Matt Martz (@sivel)

preview | supported by community

Install collection

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


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

creates / deletes a Rackspace Public Cloud instance and optionally waits for it to be 'running'.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
env:
    description:
    - Environment as configured in I(~/.pyrax.cfg), see U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration).
    version_added: '1.5'
    version_added_collection: community.general

meta:
    description:
    - A hash of metadata to associate with the instance

name:
    description:
    - Name to give the instance

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

count:
    default: 1
    description:
    - number of instances to launch

files:
    description:
    - Files to insert into the instance. remotefilename:localcontent

group:
    description:
    - host group to assign to server, is also used for idempotent operations to ensure
      a specific number of instances

image:
    description:
    - image to use for the instance. Can be an C(id), C(human_id) or C(name). With I(boot_from_volume),
      a Cloud Block Storage volume will be created with this image

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Indicate desired state of the resource

flavor:
    description:
    - flavor to use for the instance

region:
    default: DFW
    description:
    - Region to create an instance in.

api_key:
    aliases:
    - password
    description:
    - Rackspace API key, overrides I(credentials).

key_name:
    aliases:
    - keypair
    description:
    - key pair to use on the instance

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).

username:
    description:
    - Rackspace username, overrides I(credentials).

tenant_id:
    description:
    - The tenant ID used for authentication.
    version_added: '1.5'
    version_added_collection: community.general

user_data:
    description:
    - Data to be uploaded to the servers config drive. This option implies I(config_drive).
      Can be a file path or a string

boot_volume:
    description:
    - Cloud Block Storage ID or Name to use as the boot volume of the instance

credentials:
    aliases:
    - creds_file
    description:
    - File to find the Rackspace credentials in. Ignored if I(api_key) and I(username)
      are provided.

disk_config:
    choices:
    - auto
    - manual
    default: auto
    description:
    - Disk partitioning strategy

exact_count:
    default: 'no'
    description:
    - Explicitly ensure an exact count of instances, used with state=active/present. If
      specified as C(yes) and I(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 I(count) additional servers will be added.
    type: bool

tenant_name:
    description:
    - The tenant name used for authentication.
    version_added: '1.5'
    version_added_collection: community.general

config_drive:
    default: 'no'
    description:
    - Attach read-only configuration drive to server as label config-2
    type: bool

count_offset:
    default: 1
    description:
    - number count to start at

instance_ids:
    description:
    - list of instance ids, currently only used when state='absent' to remove instances

wait_timeout:
    default: 300
    description:
    - how long before wait gives up, in seconds

auth_endpoint:
    default: https://identity.api.rackspacecloud.com/v2.0/
    description:
    - The URI of the authentication service.
    version_added: '1.5'
    version_added_collection: community.general

identity_type:
    default: rackspace
    description:
    - Authentication mechanism to use, such as rackspace or keystone.
    version_added: '1.5'
    version_added_collection: community.general

auto_increment:
    default: 'yes'
    description:
    - Whether or not to increment a single number with the name of the created servers.
      Only applicable when used with the I(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
    version_added: '1.5'
    version_added_collection: community.general

boot_from_volume:
    default: 'no'
    description:
    - Whether or not to boot the instance from a Cloud Block Storage volume. If C(yes)
      and I(image) is specified a new volume will be created at boot time. I(boot_volume_size)
      is required with I(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 I(image) and
      I(boot_from_volume).

extra_client_args:
    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.

extra_create_args:
    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.

boot_volume_terminate:
    default: 'no'
    description:
    - Whether the I(boot_volume) or newly created volume from I(image) will be terminated
      when the server is terminated
    type: bool