community.general.hwc_vpc_security_group – Creates a resource of Vpc/SecurityGroup in Huawei Cloud

Note

This plugin is part of the community.general collection (version 1.3.6).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.hwc_vpc_security_group.

New in version 0.2.0: of community.general

Synopsis

  • vpc security group management.

Requirements

The below requirements are needed on the host that executes this module.

  • keystoneauth1 >= 3.6.0

Parameters

Parameter Choices/Defaults Comments
domain
string / required
The name of the Domain to scope to (Identity v3). (currently only domain names are supported, and not domain IDs).
enterprise_project_id
string
Default:
0
Specifies the enterprise project ID. When creating a security group, associate the enterprise project ID with the security group.s
id
string
The id of resource to be managed.
identity_endpoint
string / required
The Identity authentication URL.
name
string / required
Specifies the security group name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores _, hyphens (-), and periods (.).
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.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
user
string / required
The user name to login with (currently only user names are supported, and not user IDs).
vpc_id
string
Specifies the resource ID of the VPC to which the security group belongs.

Notes

Note

  • If id option is provided, it takes precedence over name, enterprise_project_id and vpc_id for security group selection.

  • name, enterprise_project_id and vpc_id are used for security group selection. If more than one security group with this options exists, execution is aborted.

  • No parameter support updating. If one of option is changed, the module will create a new resource.

  • For authentication, you can set identity_endpoint using the ANSIBLE_HWC_IDENTITY_ENDPOINT env variable.

  • For authentication, you can set user using the ANSIBLE_HWC_USER env variable.

  • For authentication, you can set password using the ANSIBLE_HWC_PASSWORD env variable.

  • For authentication, you can set domain using the ANSIBLE_HWC_DOMAIN env variable.

  • For authentication, you can set project using the ANSIBLE_HWC_PROJECT env variable.

  • For authentication, you can set region using the ANSIBLE_HWC_REGION env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples

# create a security group
- name: Create a security group
  community.general.hwc_vpc_security_group:
    name: "ansible_network_security_group_test"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
enterprise_project_id
string
success
Specifies the enterprise project ID. When creating a security group, associate the enterprise project ID with the security group.

name
string
success
Specifies the security group name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores _, hyphens (-), and periods (.).

rules
complex
success
Specifies the security group rule, which ensures that resources in the security group can communicate with one another.

 
description
string
success
Provides supplementary information about the security group rule.

 
direction
string
success
Specifies the direction of access control. The value can be egress or ingress.

 
ethertype
string
success
Specifies the IP protocol version. The value can be IPv4 or IPv6.

 
id
string
success
Specifies the security group rule ID.

 
port_range_max
integer
success
Specifies the end port number. The value ranges from 1 to 65535. If the protocol is not icmp, the value cannot be smaller than the port_range_min value. An empty value indicates all ports.

 
port_range_min
integer
success
Specifies the start port number. The value ranges from 1 to 65535. The value cannot be greater than the port_range_max value. An empty value indicates all ports.

 
protocol
string
success
Specifies the protocol type. The value can be icmp, tcp, udp, or others. If the parameter is left blank, the security group supports all protocols.

 
remote_address_group_id
string
success
Specifies the ID of remote IP address group.

 
remote_group_id
string
success
Specifies the ID of the peer security group.

 
remote_ip_prefix
string
success
Specifies the remote IP address. If the access control direction is set to egress, the parameter specifies the source IP address. If the access control direction is set to ingress, the parameter specifies the destination IP address.

vpc_id
string
success
Specifies the resource ID of the VPC to which the security group belongs.



Authors

  • Huawei Inc. (@huaweicloud)