community.general.cs_vlan_ip_range (0.1.1) — module

Manages VLAN IP ranges on Apache CloudStack based clouds.

Authors: David Passante (@dpassante)

preview | 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 and delete VLAN IP range.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create a VLAN IP range for network test
  cs_vlan_ip_range:
    network: test
    vlan: 98
    start_ip: 10.2.4.10
    end_ip: 10.2.4.100
    gateway: 10.2.4.1
    netmask: 255.255.255.0
    zone: zone-02
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove a VLAN IP range for network test
  cs_vlan_ip_range:
    state: absent
    network: test
    start_ip: 10.2.4.10
    end_ip: 10.2.4.100
    zone: zone-02
  delegate_to: localhost

Inputs

    
vlan:
    description:
    - The ID or VID of the network.
    - If not specified, will be defaulted to the vlan of the network.
    type: str

zone:
    description:
    - The Zone ID of the VLAN IP range.
    - If not set, default zone is used.
    type: str

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

domain:
    description:
    - Domain of the account owning the VLAN.
    type: str

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

account:
    description:
    - Account who owns the VLAN.
    - Mutually exclusive with I(project).
    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 VLAN IP range.
    - Required if I(state=present).
    type: str

netmask:
    description:
    - The netmask of the VLAN IP range.
    - Required if I(state=present).
    type: str

network:
    description:
    - The network name or id.
    - Required if I(for_virtual_network) and I(physical_network) are not set.
    type: str

project:
    description:
    - Project who owns the VLAN.
    - Mutually exclusive with I(account).
    type: str

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

start_ip:
    description:
    - The beginning IPv4 address in the VLAN IP range.
    - Only considered on create.
    required: true
    type: str

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

start_ipv6:
    description:
    - The beginning IPv6 address in the IPv6 network range.
    - 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

gateway_ipv6:
    description:
    - The gateway of the IPv6 network.
    - Only considered on create.
    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

physical_network:
    description:
    - The physical network name or id.
    type: str

for_virtual_network:
    default: false
    description:
    - C(yes) if VLAN is of Virtual type, C(no) if Direct.
    - If set to C(yes) but neither I(physical_network) or I(network) is set CloudStack
      will try to add the VLAN range to the Physical Network with a Public traffic type.
    type: bool

Outputs

account:
  description: Account who owns the network.
  returned: if available
  sample: example account
  type: str
cidr_ipv6:
  description: The CIDR of IPv6 network.
  returned: if available
  sample: 2001:db8::/64
  type: str
domain:
  description: Domain name of the VLAN IP range.
  returned: success
  sample: ROOT
  type: str
end_ip:
  description: The end ip of the VLAN IP range.
  returned: success
  sample: 10.2.4.100
  type: str
end_ipv6:
  description: The end ipv6 of the VLAN IP range.
  returned: if available
  sample: 2001:db8::50
  type: str
for_systemvms:
  description: Whether VLAN IP range is dedicated to system vms or not.
  returned: success
  sample: false
  type: bool
for_virtual_network:
  description: Whether VLAN IP range is of Virtual type or not.
  returned: success
  sample: false
  type: bool
gateway:
  description: IPv4 gateway.
  returned: success
  sample: 10.2.4.1
  type: str
gateway_ipv6:
  description: IPv6 gateway.
  returned: if available
  sample: 2001:db8::1
  type: str
id:
  description: UUID of the VLAN IP range.
  returned: success
  sample: 04589590-ac63-4ffc-93f5-b698b8ac38b6
  type: str
netmask:
  description: IPv4 netmask.
  returned: success
  sample: 255.255.255.0
  type: str
network:
  description: The network of vlan range
  returned: if available
  sample: test
  type: str
physical_network:
  description: The physical network VLAN IP range belongs to.
  returned: success
  sample: 04589590-ac63-4ffc-93f5-b698b8ac38b6
  type: str
project:
  description: Project who owns the network.
  returned: if available
  sample: example project
  type: str
start_ip:
  description: The start ip of the VLAN IP range.
  returned: success
  sample: 10.2.4.10
  type: str
start_ipv6:
  description: The start ipv6 of the VLAN IP range.
  returned: if available
  sample: 2001:db8::10
  type: str
vlan:
  description: The ID or VID of the VLAN.
  returned: success
  sample: vlan://98
  type: str
zone:
  description: Name of zone.
  returned: success
  sample: zone-02
  type: str