community.general.cs_network (0.1.1) — module

Manages networks 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, restart and delete networks.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a network
  cs_network:
    name: my network
    zone: gva-01
    network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService
    network_domain: example.com
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a VPC tier
  cs_network:
    name: my VPC tier 1
    zone: gva-01
    vpc: my VPC
    network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks
    gateway: 10.43.0.1
    netmask: 255.255.255.0
    acl: my web acl
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update a network
  cs_network:
    name: my network
    display_text: network of domain example.local
    network_domain: example.local
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Restart a network with clean up
  cs_network:
    name: my network
    clean_up: yes
    state: restarted
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a network
  cs_network:
    name: my network
    state: absent
  delegate_to: localhost

Inputs

    
acl:
    description:
    - The name of the access control list for the VPC network tier.
    type: str

vpc:
    description:
    - Name of the VPC of the network.
    type: str

name:
    description:
    - Name (case sensitive) of the network.
    required: true
    type: str

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

vlan:
    description:
    - The ID or VID of the network.
    type: str

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

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

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

end_ip:
    description:
    - The ending IPv4 address of the network belongs to.
    - If not specified, value of I(start_ip) is used.
    - Only considered on create.
    type: str

account:
    description:
    - Account the network 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

gateway:
    description:
    - The gateway of the network.
    - Required for shared networks and isolated networks when it belongs to a VPC.
    - Only considered on create.
    type: str

netmask:
    description:
    - The netmask of the network.
    - Required for shared networks and isolated networks when it belongs to a VPC.
    - Only considered on create.
    type: str

project:
    description:
    - Name of the project the network to be deployed in.
    type: str

acl_type:
    choices:
    - account
    - domain
    description:
    - Access control type for the network.
    - If not specified, Cloudstack will default to C(account) for isolated networks
    - and C(domain) for shared networks.
    - Only considered on create.
    type: str

clean_up:
    default: false
    description:
    - Cleanup old network elements.
    - Only considered on I(state=restarted).
    type: bool

end_ipv6:
    description:
    - The ending IPv6 address of the network belongs to.
    - If not specified, value of I(start_ipv6) is used.
    - Only considered on create.
    type: str

start_ip:
    description:
    - The beginning IPv4 address of the network belongs to.
    - Only considered on create.
    type: str

cidr_ipv6:
    description:
    - CIDR of IPv6 network, must be at least /64.
    - Only considered on create.
    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

start_ipv6:
    description:
    - The beginning IPv6 address of the network belongs to.
    - Only considered on create.
    type: str

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 network.
    - If not specified, I(name) will be used as I(display_text).
    type: str

gateway_ipv6:
    description:
    - The gateway of the IPv6 network.
    - Required for shared networks.
    - Only considered on create.
    type: str

isolated_pvlan:
    description:
    - The isolated private VLAN for this network.
    type: str

network_domain:
    description:
    - The network domain.
    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

network_offering:
    description:
    - Name of the offering for the network.
    - Required if I(state=present).
    type: str

subdomain_access:
    description:
    - Defines whether to allow subdomains to use networks dedicated to their parent domain(s).
    - Should be used with I(acl_type=domain).
    - Only considered on create.
    type: bool

Outputs

account:
  description: Account the network is related to.
  returned: success
  sample: example account
  type: str
acl:
  description: Name of the access control list for the VPC network tier.
  returned: success
  sample: My ACL
  type: str
  version_added: '2.5'
  version_added_collection: community.general
acl_id:
  description: ID of the access control list for the VPC network tier.
  returned: success
  sample: dfafcd55-0510-4b8c-b6c5-b8cedb4cfd88
  type: str
  version_added: '2.5'
  version_added_collection: community.general
acl_type:
  description: Access type of the network (Domain, Account).
  returned: success
  sample: Account
  type: str
broadcast_domain_type:
  description: Broadcast domain type of the network.
  returned: success
  sample: Vlan
  type: str
cidr:
  description: IPv4 network CIDR.
  returned: success
  sample: 10.101.64.0/24
  type: str
cidr_ipv6:
  description: IPv6 network CIDR.
  returned: if available
  sample: 2001:db8::/64
  type: str
display_text:
  description: Display text of the network.
  returned: success
  sample: web project
  type: str
dns1:
  description: IP address of the 1st nameserver.
  returned: success
  sample: 1.2.3.4
  type: str
dns2:
  description: IP address of the 2nd nameserver.
  returned: success
  sample: 1.2.3.4
  type: str
domain:
  description: Domain the network is related to.
  returned: success
  sample: ROOT
  type: str
gateway:
  description: IPv4 gateway.
  returned: success
  sample: 10.101.64.1
  type: str
gateway_ipv6:
  description: IPv6 gateway.
  returned: if available
  sample: 2001:db8::1
  type: str
id:
  description: UUID of the network.
  returned: success
  sample: 04589590-ac63-4ffc-93f5-b698b8ac38b6
  type: str
is_persistent:
  description: Whether the network is persistent or not.
  returned: success
  sample: false
  type: bool
is_system:
  description: Whether the network is system related or not.
  returned: success
  sample: false
  type: bool
  version_added: '2.5'
  version_added_collection: community.general
name:
  description: Name of the network.
  returned: success
  sample: web project
  type: str
netmask:
  description: IPv4 netmask.
  returned: success
  sample: 255.255.255.0
  type: str
network_domain:
  description: The network domain
  returned: success
  sample: example.local
  type: str
network_offering:
  description: The network offering name.
  returned: success
  sample: DefaultIsolatedNetworkOfferingWithSourceNatService
  type: str
network_offering_availability:
  description: The availability of the network offering the network is created from
  returned: success
  sample: Optional
  type: str
  version_added: '2.5'
  version_added_collection: community.general
network_offering_conserve_mode:
  description: Whether the network offering has IP conserve mode enabled or not.
  returned: success
  sample: false
  type: bool
  version_added: '2.5'
  version_added_collection: community.general
network_offering_display_text:
  description: The network offering display text.
  returned: success
  sample: Offering for Isolated Vpc networks with Source Nat service enabled
  type: str
  version_added: '2.5'
  version_added_collection: community.general
project:
  description: Name of project.
  returned: success
  sample: Production
  type: str
state:
  description: State of the network (Allocated, Implemented, Setup).
  returned: success
  sample: Allocated
  type: str
tags:
  description: List of resource tags associated with the network.
  returned: success
  sample: '[ { "key": "foo", "value": "bar" } ]'
  type: list
traffic_type:
  description: Traffic type of the network.
  returned: success
  sample: Guest
  type: str
type:
  description: Type of the network.
  returned: success
  sample: Isolated
  type: str
vpc:
  description: Name of the VPC.
  returned: if available
  sample: My VPC
  type: str
zone:
  description: Name of zone.
  returned: success
  sample: ch-gva-2
  type: str