community.general.cs_vpc (0.1.1) — module

Manages VPCs on Apache CloudStack based clouds.

Authors: René Moser (@resmo)

stableinterface | 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

Create, update and delete VPCs.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure a VPC is present but not started after creating
  cs_vpc:
    name: my_vpc
    display_text: My example VPC
    cidr: 10.10.0.0/16
    state: stopped
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure a VPC is present and started after creating
  cs_vpc:
    name: my_vpc
    display_text: My example VPC
    cidr: 10.10.0.0/16
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure a VPC is absent
  cs_vpc:
    name: my_vpc
    state: absent
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure a VPC is restarted with clean up
  cs_vpc:
    name: my_vpc
    clean_up: yes
    state: restarted
  delegate_to: localhost

Inputs

    
cidr:
    description:
    - CIDR of the VPC, e.g. 10.1.0.0/16
    - All VPC guest networks' CIDRs must be within this CIDR.
    - Required on I(state=present).
    type: str

name:
    description:
    - Name of the VPC.
    required: true
    type: str

tags:
    aliases:
    - tag
    description:
    - List of tags. Tags are a list of dictionaries having keys I(key) and I(value).
    - 'For deleting all tags, set an empty list e.g. I(tags: []).'
    type: list

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

state:
    choices:
    - present
    - absent
    - stopped
    - restarted
    default: present
    description:
    - State of the VPC.
    - The state C(present) creates a started VPC.
    - The state C(stopped) is only considered while creating the VPC, added in version
      2.6.
    type: str

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

account:
    description:
    - Account the VPC 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.
    - As the last option, the value is taken from the ini config file, also see the notes.
    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.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

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

clean_up:
    description:
    - Whether to redeploy a VPC router or not when I(state=restarted)
    type: bool

api_region:
    default: cloudstack
    description:
    - Name of the ini section in the C(cloustack.ini) file.
    - If not given, the C(CLOUDSTACK_REGION) env variable is considered.
    type: str

api_secret:
    description:
    - Secret key of the CloudStack API.
    - If not set, the C(CLOUDSTACK_SECRET) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

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

api_timeout:
    description:
    - HTTP timeout in seconds.
    - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    - Fallback value is 10 seconds if not specified.
    type: int

display_text:
    description:
    - Display text of the VPC.
    - If not set, I(name) will be used for creating.
    type: str

vpc_offering:
    description:
    - Name of the VPC offering.
    - If not set, default VPC offering is used.
    type: str

network_domain:
    description:
    - Network domain for the VPC.
    - All networks inside the VPC will belong to this domain.
    - Only considered while creating the VPC, can not be changed.
    type: str

api_http_method:
    choices:
    - get
    - post
    description:
    - HTTP method used to query the API endpoint.
    - If not given, the C(CLOUDSTACK_METHOD) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    - Fallback value is C(get) if not specified.
    type: str

Outputs

account:
  description: Account the VPC is related to.
  returned: success
  sample: example account
  type: str
cidr:
  description: CIDR of the VPC.
  returned: success
  sample: 10.10.0.0/16
  type: str
display_text:
  description: Display text of the VPC.
  returned: success
  sample: My example VPC
  type: str
distributed_vpc_router:
  description: Whether the VPC uses distributed router or not.
  returned: success
  sample: true
  type: bool
domain:
  description: Domain the VPC is related to.
  returned: success
  sample: example domain
  type: str
id:
  description: UUID of the VPC.
  returned: success
  sample: 04589590-ac63-4ffc-93f5-b698b8ac38b6
  type: str
name:
  description: Name of the VPC.
  returned: success
  sample: my_vpc
  type: str
network_domain:
  description: Network domain of the VPC.
  returned: success
  sample: example.com
  type: str
project:
  description: Name of project the VPC is related to.
  returned: success
  sample: Production
  type: str
redundant_vpc_router:
  description: Whether the VPC has redundant routers or not.
  returned: success
  sample: true
  type: bool
region_level_vpc:
  description: Whether the VPC is region level or not.
  returned: success
  sample: true
  type: bool
restart_required:
  description: Whether the VPC router needs a restart or not.
  returned: success
  sample: true
  type: bool
state:
  description: State of the VPC.
  returned: success
  sample: Enabled
  type: str
tags:
  description: List of resource tags associated with the VPC.
  returned: success
  sample: '[ { "key": "foo", "value": "bar" } ]'
  type: list
zone:
  description: Name of zone the VPC is in.
  returned: success
  sample: ch-gva-2
  type: str