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

Manages secondary IPs of an instance on Apache CloudStack based clouds.

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

Authors: René Moser (@resmo)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.18

Description

Add and remove secondary IPs to and from a NIC of an instance.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Assign a specific IP to the default NIC of the VM
  cs_instance_nic_secondaryip:
    vm: customer_xy
    vm_guest_ip: 10.10.10.10
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Note: If vm_guest_ip is not set, you will get a new IP address on every run.
- name: Assign an IP to the default NIC of the VM
  cs_instance_nic_secondaryip:
    vm: customer_xy
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a specific IP from the default NIC
  cs_instance_nic_secondaryip:
    vm: customer_xy
    vm_guest_ip: 10.10.10.10
    state: absent
  delegate_to: localhost

Inputs

    
vm:
    aliases:
    - name
    description:
    - Name of instance.
    required: true
    type: str

vpc:
    description:
    - Name of the VPC the I(vm) is related to.
    type: str

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

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

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

account:
    description:
    - Account the instance 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:
    - Name of the network.
    - Required to find the NIC if instance has multiple networks assigned.
    type: str

project:
    description:
    - Name of the project the instance is deployed in.
    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

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

vm_guest_ip:
    aliases:
    - secondary_ip
    description:
    - Secondary IP address to be added to the instance nic.
    - If not set, the API always returns a new IP address and idempotency is not given.
    type: str

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 VM is related to.
  returned: success
  sample: example account
  type: str
domain:
  description: Domain the VM is related to.
  returned: success
  sample: example domain
  type: str
id:
  description: UUID of the NIC.
  returned: success
  sample: 87b1e0ce-4e01-11e4-bb66-0050569e64b8
  type: str
ip_address:
  description: Primary IP of the NIC.
  returned: success
  sample: 10.10.10.10
  type: str
mac_address:
  description: MAC address of the NIC.
  returned: success
  sample: 02:00:33:31:00:e4
  type: str
netmask:
  description: Netmask of the NIC.
  returned: success
  sample: 255.255.255.0
  type: str
network:
  description: Name of the network if not default.
  returned: success
  sample: sync network
  type: str
project:
  description: Name of project the VM is related to.
  returned: success
  sample: Production
  type: str
vm:
  description: Name of the VM.
  returned: success
  sample: web-01
  type: str
vm_guest_ip:
  description: Secondary IP of the NIC.
  returned: success
  sample: 10.10.10.10
  type: str