community.general.cs_router (0.1.1) — module

Manages routers 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

Start, restart, stop and destroy routers.

I(state=present) is not able to create routers, use M(cs_network) instead.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Ensure the router has the desired service offering, no matter if
# the router is running or not.
- name: Present router
  cs_router:
    name: r-40-VM
    service_offering: System Offering for Software Router
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure started
  cs_router:
    name: r-40-VM
    state: started
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Ensure started with desired service offering.
# If the service offerings changes, router will be rebooted.
- name: Ensure started with desired service offering
  cs_router:
    name: r-40-VM
    service_offering: System Offering for Software Router
    state: started
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure stopped
  cs_router:
    name: r-40-VM
    state: stopped
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a router
  cs_router:
    name: r-40-VM
    state: absent
  delegate_to: localhost

Inputs

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

zone:
    description:
    - Name of the zone the router is deployed in.
    - If not set, all zones are used.
    type: str

state:
    choices:
    - present
    - absent
    - started
    - stopped
    - restarted
    default: present
    description:
    - State of the router.
    type: str

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

account:
    description:
    - Account the router 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 router is related to.
    type: str

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

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

service_offering:
    description:
    - Name or id of the service offering of the router.
    type: str

Outputs

account:
  description: Account the router is related to.
  returned: success
  sample: admin
  type: str
created:
  description: Date of the router was created.
  returned: success
  sample: 2014-12-01T14:57:57+0100
  type: str
domain:
  description: Domain the router is related to.
  returned: success
  sample: ROOT
  type: str
id:
  description: UUID of the router.
  returned: success
  sample: 04589590-ac63-4ffc-93f5-b698b8ac38b6
  type: str
name:
  description: Name of the router.
  returned: success
  sample: r-40-VM
  type: str
redundant_state:
  description: Redundant state of the router.
  returned: success
  sample: UNKNOWN
  type: str
requires_upgrade:
  description: Whether the router needs to be upgraded to the new template.
  returned: success
  sample: false
  type: bool
role:
  description: Role of the router.
  returned: success
  sample: VIRTUAL_ROUTER
  type: str
service_offering:
  description: Name of the service offering the router has.
  returned: success
  sample: System Offering For Software Router
  type: str
state:
  description: State of the router.
  returned: success
  sample: Active
  type: str
template_version:
  description: Version of the system VM template.
  returned: success
  sample: 4.5.1
  type: str
zone:
  description: Name of zone the router is in.
  returned: success
  sample: ch-gva-2
  type: str