On this page
community.general.hwc_vpc_port – Creates a resource of Vpc/Port in Huawei Cloud
Note
This plugin is part of the community.general collection (version 3.8.1).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.hwc_vpc_port.
New in version 0.2.0: of community.general
Synopsis
- vpc port management.
 
Requirements
The below requirements are needed on the host that executes this module.
- keystoneauth1 >= 3.6.0
 
Parameters
| Parameter | Choices/Defaults | Comments | |
|---|---|---|---|
| admin_state_up
        
        boolean
         | 
      
       
  | 
      
        
        Specifies the administrative state of the port.
         | 
     |
| allowed_address_pairs
        
        list / elements=dictionary
         | 
      
        
        Specifies a set of zero or more allowed address pairs.
         | 
     ||
| ip_address
        
        string
         | 
      
        
        Specifies the IP address. It cannot set it to 0.0.0.0. Configure an independent security group for the port if a large CIDR block (subnet mask less than 24) is configured for parameter allowed_address_pairs.
         | 
     ||
| mac_address
        
        string
         | 
      
        
        Specifies the MAC address.
         | 
     ||
| domain
        
        string / required
         | 
      
        
        The name of the Domain to scope to (Identity v3). (currently only domain names are supported, and not domain IDs).
         | 
     ||
| extra_dhcp_opts
        
        list / elements=dictionary
         | 
      
        
        Specifies the extended option of DHCP.
         | 
     ||
| name
        
        string
         | 
      
        
        Specifies the option name.
         | 
     ||
| value
        
        string
         | 
      
        
        Specifies the option value.
         | 
     ||
| id
        
        string
         | 
      
        
        The id of resource to be managed.
         | 
     ||
| identity_endpoint
        
        string / required
         | 
      
        
        The Identity authentication URL.
         | 
     ||
| ip_address
        
        string
         | 
      
        
        Specifies the port IP address.
         | 
     ||
| name
        
        string
         | 
      
        
        Specifies the port name. The value can contain no more than 255 characters.
         | 
     ||
| password
        
        string / required
         | 
      
        
        The password to login with.
         | 
     ||
| project
        
        string / required
         | 
      
        
        The name of the Tenant (Identity v2) or Project (Identity v3). (currently only project names are supported, and not project IDs).
         | 
     ||
| region
        
        string
         | 
      
        
        The region to which the project belongs.
         | 
     ||
| security_groups
        
        list / elements=string
         | 
      
        
        Specifies the ID of the security group.
         | 
     ||
| state
        
        string
         | 
      
       
  | 
      
        
        Whether the given object should exist in Huawei Cloud.
         | 
     |
| subnet_id
        
        string / required
         | 
      
        
        Specifies the ID of the subnet to which the port belongs.
         | 
     ||
| timeouts
        
        dictionary
         | 
      
        
        The timeouts for each operations.
         | 
     ||
| create
        
        string
         | 
      Default: 
        "15m"
         | 
      
        
        The timeouts for create operation.
         | 
     |
| user
        
        string / required
         | 
      
        
        The user name to login with (currently only user names are supported, and not user IDs).
         | 
     ||
Notes
Note
- For authentication, you can set identity_endpoint using the 
ANSIBLE_HWC_IDENTITY_ENDPOINTenv variable. - For authentication, you can set user using the 
ANSIBLE_HWC_USERenv variable. - For authentication, you can set password using the 
ANSIBLE_HWC_PASSWORDenv variable. - For authentication, you can set domain using the 
ANSIBLE_HWC_DOMAINenv variable. - For authentication, you can set project using the 
ANSIBLE_HWC_PROJECTenv variable. - For authentication, you can set region using the 
ANSIBLE_HWC_REGIONenv variable. - Environment variables values will only be used if the playbook values are not set.
 
Examples
# create a port
- name: Create vpc
  hwc_network_vpc:
    cidr: "192.168.100.0/24"
    name: "ansible_network_vpc_test"
  register: vpc
- name: Create subnet
  hwc_vpc_subnet:
    gateway_ip: "192.168.100.32"
    name: "ansible_network_subnet_test"
    dhcp_enable: True
    vpc_id: "{{ vpc.id }}"
    cidr: "192.168.100.0/26"
  register: subnet
- name: Create a port
  community.general.hwc_vpc_port:
    subnet_id: "{{ subnet.id }}"
    ip_address: "192.168.100.33"
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | |
|---|---|---|---|
| admin_state_up
        
        boolean
         | 
      success | 
        
        Specifies the administrative state of the port.
          | 
     |
| allowed_address_pairs
        
        list / elements=string
         | 
      success | 
        
        Specifies a set of zero or more allowed address pairs.
          | 
     |
| ip_address
        
        string
         | 
      success | 
        
        Specifies the IP address. It cannot set it to 0.0.0.0. Configure an independent security group for the port if a large CIDR block (subnet mask less than 24) is configured for parameter allowed_address_pairs.
          | 
     |
| mac_address
        
        string
         | 
      success | 
        
        Specifies the MAC address.
          | 
     |
| extra_dhcp_opts
        
        list / elements=string
         | 
      success | 
        
        Specifies the extended option of DHCP.
          | 
     |
| name
        
        string
         | 
      success | 
        
        Specifies the option name.
          | 
     |
| value
        
        string
         | 
      success | 
        
        Specifies the option value.
          | 
     |
| ip_address
        
        string
         | 
      success | 
        
        Specifies the port IP address.
          | 
     |
| mac_address
        
        string
         | 
      success | 
        
        Specifies the port MAC address.
          | 
     |
| name
        
        string
         | 
      success | 
        
        Specifies the port name. The value can contain no more than 255 characters.
          | 
     |
| security_groups
        
        list / elements=string
         | 
      success | 
        
        Specifies the ID of the security group.
          | 
     |
| subnet_id
        
        string
         | 
      success | 
        
        Specifies the ID of the subnet to which the port belongs.
          | 
     |
Authors
- Huawei Inc. (@huaweicloud)
 
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/latest/collections/community/general/hwc_vpc_port_module.html