opentelekomcloud.cloud.subnet (0.14.2) — module

Manage VPC subnet

| "added in version" 0.11.0 of opentelekomcloud.cloud"

Authors: Anton Kachurin (@outcatcher)

Install collection

Install with ansible-galaxy collection install opentelekomcloud.cloud:==0.14.2


Add to requirements.yml

  collections:
    - name: opentelekomcloud.cloud
      version: 0.14.2

Description

Manage (create, update or delete) Open Telekom Cloud VPC subnet.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create VPC
  opentelekomcloud.cloud.vpc:
    name: "vpc-test"
    cidr: "192.168.0.0/16"
  register: vpc
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create subnet
  opentelekomcloud.cloud.subnet:
    name: "test-subnet"
    vpc_id: "{{ vpc.vpc.id }}"
    cidr: "192.168.0.0/16"
    gateway_ip: "192.168.0.1"
    dns_list:
      - "100.125.4.25"
      - "100.125.129.199"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update subnet
  opentelekomcloud.cloud.subnet:
    name: "test-subnet"
    vpc_id: "{{ vpc.vpc.id }}"
    dns_list:
      - "100.125.4.25"
      - "1.1.1.1"
    dhcp_enable: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete subnet
  opentelekomcloud.cloud.subnet:
    name: "test-subnet"
    vpc_id: "{{ vpc.vpc.id }}"
    state: absent

Inputs

    
vpc:
    aliases:
    - vpc_id
    description: Specifies the name or ID of the VPC to which the subnet belongs.
    required: true
    type: str

auth:
    description:
    - Dictionary containing auth information as needed by the cloud's auth plugin strategy.
      For the default I(password) plugin, this would contain I(auth_url), I(username),
      I(password), I(project_name) and any information about domains (for example, I(os_user_domain_name)
      or I(os_project_domain_name)) if the cloud supports them. For other plugins, this
      param will need to contain whatever parameters that auth plugin requires. This parameter
      is not needed if a named cloud is provided or OpenStack OS_* environment variables
      are present.
    type: dict

cidr:
    description:
    - Specifies the subnet CIDR block.
    - The value must be within the VPC CIDR block.
    - The value must be in CIDR format. The subnet mask cannot be greater than 28.
    type: str

name:
    description:
    - Specifies the subnet name or ID.
    - When creating a new subnet, the value can contain 1 to 64 characters, including
      letters, digits, underscores (_), hyphens (-), and periods (.).
    required: true
    type: str

wait:
    default: true
    description:
    - Should ansible wait until the requested resource is complete.
    type: bool

cloud:
    description:
    - Named cloud or cloud config to operate against. If I(cloud) is a string, it references
      a named cloud config as defined in an OpenStack clouds.yaml file. Provides default
      values for I(auth) and I(auth_type). This parameter is not needed if I(auth) is
      provided or if OpenStack OS_* environment variables are present. If I(cloud) is
      a dict, it contains a complete cloud configuration like would be in a section of
      clouds.yaml.
    type: raw

state:
    choices:
    - present
    - absent
    default: present
    description: Indicate desired state of the resource.
    type: str

ca_cert:
    aliases:
    - cacert
    description:
    - A path to a CA Cert bundle that can be used as part of verifying SSL API requests.
    type: str

timeout:
    default: 180
    description:
    - How long should ansible wait for the requested resource.
    type: int

dns_list:
    aliases:
    - dnsList
    description:
    - Specifies the DNS server address list of a subnet.
    - This field is required if use more than two DNS servers.
    - This parameter value is the superset of both I(primary_dns) and I(secondary_dns).
    elements: str
    type: list

auth_type:
    description:
    - Name of the auth plugin to use. If the cloud uses something other than password
      authentication, the name of the plugin should be indicated here and the contents
      of the I(auth) parameter should be updated accordingly.
    type: str

interface:
    aliases:
    - endpoint_type
    choices:
    - admin
    - internal
    - public
    default: public
    description:
    - Endpoint URL type to fetch from the service catalog.
    type: str

client_key:
    aliases:
    - key
    description:
    - A path to a client key to use as part of the SSL transaction.
    type: str

gateway_ip:
    description:
    - Specifies the gateway of the subnet.
    - The value must be an IP address in the subnet.
    - The value must be a valid IP address.
    type: str

api_timeout:
    description:
    - How long should the socket layer wait before timing out for API calls. If this is
      omitted, nothing will be passed to the requests library.
    type: int

client_cert:
    aliases:
    - cert
    description:
    - A path to a client certificate to use as part of the SSL transaction.
    type: str

description:
    description:
    - Provides supplementary information about the subnet.
    - The value can contain no more than 255 characters and cannot contain angle brackets
      (< or >).
    type: str

dhcp_enable:
    description:
    - Specifies whether DHCP is enabled for the subnet.
    - The value can be true (enabled) or false (disabled).
    - If this parameter is left blank, the system automatically sets it to true by default.
      If this parameter is set to false, newly created ECSs cannot obtain IP addresses,
      and usernames and passwords cannot be injected using Cloud-init.
    type: bool

primary_dns:
    description:
    - Specifies the IP address of DNS server 1 on the subnet.
    - The value must be an IP address.
    type: str

region_name:
    description:
    - Name of the region.
    type: str

sdk_log_path:
    description:
    - Path to the logfile of the OpenStackSDK. If empty no log is written
    type: str

sdk_log_level:
    choices:
    - ERROR
    - WARN
    - INFO
    - DEBUG
    default: WARN
    description: Log level of the OpenStackSDK
    type: str

secondary_dns:
    description:
    - Specifies the IP address of DNS server 2 on the subnet.
    - The value must be an IP address.
    type: str

validate_certs:
    aliases:
    - verify
    description:
    - Whether or not SSL API requests should be verified.
    - Before Ansible 2.3 this defaulted to C(yes).
    type: bool

extra_dhcp_opts:
    description: Specifies the NTP server address configured for the subnet.
    elements: dict
    suboptions:
      opt_name:
        choices:
        - ntp
        description:
        - Specifies the NTP server address name configured for the subnet.
        required: true
        type: str
      opt_value:
        description:
        - Specifies the NTP server address configured for the subnet.
        - The option ntp for opt_name indicates the NTP server configured for the subnet.
          Currently, only IPv4 addresses are supported. A maximum of four IP addresses
          can be configured, and each address must be unique. Multiple IP addresses must
          be separated using commas (,). The option null for opt_name indicates that no
          NTP server is configured for the subnet. The parameter value cannot be an empty
          string.
        type: str
    type: list

availability_zone:
    description: Specifies the AZ to which the subnet belongs.
    type: str

Outputs

subnet:
  contains:
    availability_zone:
      description: Specifies the AZ to which the subnet belongs, which can be obtained
        from endpoints.
      type: str
    cidr:
      description: Specifies the subnet CIDR block.
      type: str
    description:
      description: Provides supplementary information about the subnet.
      type: str
    dhcp_enable:
      description: Specifies whether the DHCP function is enabled for the subnet.
      type: bool
    dns_list:
      description: Specifies the DNS server address list of a subnet.
      elements: str
      type: list
    extra_dhcp_opts:
      description: Specifies the NTP server address configured for the subnet.
      elements: dict
      sample:
      - opt_name: ntp
        opt_value: 10.100.0.33,10.100.0.34
      type: list
    gateway_ip:
      description: Specifies the gateway of the subnet.
      type: str
    id:
      description: Specifies the resource identifier in the form of UUID.
      sample: 0f21367c-022d-433e-8ddb-1c31a65a05b8
      type: str
    name:
      description: Specifies the subnet name.
      sample: test-subnet
      type: str
    neutron_network_id:
      description: Specifies the ID of the corresponding network (OpenStack Neutron
        API).
      sample: 0f21367c-022d-433e-8ddb-1c31a65a05b8
      type: str
    neutron_subnet_id:
      description: Specifies the ID of the corresponding subnet (OpenStack Neutron
        API).
      sample: 235f5393-a5e0-4b7a-9655-70eb3c13e2fe
      type: str
    primary_dns:
      description: Specifies the IP address of DNS server 1 on the subnet.
      type: str
    secondary_dns:
      description: Specifies the IP address of DNS server 2 on the subnet.
      type: str
    vpc_id:
      description: Specifies the ID of the VPC to which the subnet belongs.
      type: str
  description: Created subnet resource.
  returned: On success when I(state=present)
  type: complex