ansible.builtin.cs_ip_address (v2.9.18) — module

Manages public IP address associations on Apache CloudStack based clouds.

| "added in version" 2.0 of ansible.builtin"

Authors: Darren Worrall (@dazworrall), René Moser (@resmo)

stableinterface | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.18

Description

Acquires and associates a public IP to an account or project.

Due to API limitations this is not an idempotent call, so be sure to only conditionally call this when I(state=present).

Tagging the IP address can also make the call idempotent.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Associate an IP address conditionally
  cs_ip_address:
    network: My Network
  register: ip_address
  when: instance.public_ip is undefined
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disassociate an IP address
  cs_ip_address:
    ip_address: 1.2.3.4
    state: absent
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Associate an IP address with tags
  cs_ip_address:
    network: My Network
    tags:
      - key: myCustomID
      - value: 5510c31a-416e-11e8-9013-02000a6b00bf
  register: ip_address
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disassociate an IP address with tags
  cs_ip_address:
    state: absent
    tags:
      - key: myCustomID
      - value: 5510c31a-416e-11e8-9013-02000a6b00bf
  delegate_to: localhost

Inputs

    
vpc:
    description:
    - VPC the IP address is related to.
    - Mutually exclusive with I(network).
    type: str
    version_added: '2.2'
    version_added_collection: ansible.builtin

tags:
    aliases:
    - tag
    description:
    - List of tags. Tags are a list of dictionaries having keys I(key) and I(value).
    - Tags can be used as an unique identifier for the IP Addresses.
    - In this case, at least one of them must be unique to ensure idempotency.
    type: list
    version_added: '2.6'
    version_added_collection: ansible.builtin

zone:
    description:
    - Name of the zone in which the IP address is in.
    - If not set, default zone is used.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the IP address.
    type: str

domain:
    description:
    - Domain the IP address is related to.
    type: str

account:
    description:
    - Account the IP address is related to.
    type: str

api_key:
    description:
    - API key of the CloudStack API.
    - If not given, the C(CLOUDSTACK_KEY) env variable is considered.
    required: true
    type: str

api_url:
    description:
    - URL of the CloudStack API e.g. https://cloud.example.com/client/api.
    - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered.
    required: true
    type: str

network:
    description:
    - Network the IP address is related to.
    - Mutually exclusive with I(vpc).
    type: str

project:
    description:
    - Name of the project the IP address is related to.
    type: str

api_secret:
    description:
    - Secret key of the CloudStack API.
    - If not set, the C(CLOUDSTACK_SECRET) env variable is considered.
    required: true
    type: str

ip_address:
    description:
    - Public IP address.
    - Required if I(state=absent) and I(tags) is not set.
    type: str

poll_async:
    default: true
    description:
    - Poll async jobs until job has finished.
    type: bool

api_timeout:
    default: 10
    description:
    - HTTP timeout in seconds.
    - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered.
    type: int

api_http_method:
    choices:
    - get
    - post
    default: get
    description:
    - HTTP method used to query the API endpoint.
    - If not given, the C(CLOUDSTACK_METHOD) env variable is considered.
    type: str

api_verify_ssl_cert:
    description:
    - Verify CA authority cert file.
    - If not given, the C(CLOUDSTACK_VERIFY) env variable is considered.
    type: str

Outputs

account:
  description: Account the IP address is related to.
  returned: success
  sample: example account
  type: str
domain:
  description: Domain the IP address is related to.
  returned: success
  sample: example domain
  type: str
id:
  description: UUID of the Public IP address.
  returned: success
  sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f
  type: str
ip_address:
  description: Public IP address.
  returned: success
  sample: 1.2.3.4
  type: str
project:
  description: Name of project the IP address is related to.
  returned: success
  sample: Production
  type: str
tags:
  description: List of resource tags associated with the IP address.
  returned: success
  sample: '[ { "key": "myCustomID", "value": "5510c31a-416e-11e8-9013-02000a6b00bf"
    } ]'
  type: dict
  version_added: '2.6'
  version_added_collection: ansible.builtin
zone:
  description: Name of zone the IP address is related to.
  returned: success
  sample: ch-gva-2
  type: str