Skip to content

Commit bd31553

Browse files
Merge pull request #56 from GomathiselviS/arg_spec
Add arguments_specs to roles
2 parents 16ea8a8 + b36309b commit bd31553

File tree

14 files changed

+635
-90
lines changed

14 files changed

+635
-90
lines changed
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
minor_changes:
3+
- "Add argument_specs.yaml to validate the role variables."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
argument_specs:
3+
main:
4+
version_added: 2.0.0
5+
short_description: A role to Create/Delete/Configure an Azure Load Balancer.
6+
description:
7+
- A role to Create/Delete/Configure an Azure Load Balancer.
8+
- This role requires an azure user account with valid permission.
9+
options:
10+
azure_load_balancer_with_public_ip_operation:
11+
description:
12+
- Operation to perform
13+
default: "create"
14+
choices: ["create", "delete"]
15+
azure_load_balancer_with_public_ip_resource_group:
16+
description:
17+
- Resource group on/from which the load balancer will reside.
18+
- When O(azure_load_balancer_with_public_ip_operation) is set to create, this resource group will be created if it does not exist.
19+
required: true
20+
azure_load_balancer_with_public_ip_region:
21+
description:
22+
- An Azure location for the resources.
23+
azure_load_balancer_with_public_ip_tags:
24+
description:
25+
- metadata to the resource group.
26+
type: dict
27+
azure_load_balancer_with_public_ip_load_balancer:
28+
description:
29+
- Object used to provide details for a load balancer.
30+
type: dict
31+
options:
32+
name:
33+
description: Name of the load balancer.
34+
required: true
35+
public_ip_name:
36+
description: Name of load balancer's public ip.
37+
default: "name-ip"
38+
frontend_ip_configurations:
39+
description: List of dict of frontend IPs and names to be used.
40+
type: list
41+
elements: dict
42+
options:
43+
name:
44+
description: Name of the frontend ip configuration.
45+
default: "default"
46+
public_ip_address:
47+
description:
48+
- Name of existing public IP address object in the current resource group to be associated with.
49+
default: <load balancers public ip>
50+
backend_address_pools:
51+
description: List of backend address pools where network interfaces can be attached.
52+
type: list
53+
elements: dict
54+
options:
55+
name:
56+
description: Name of the backend address pool.
57+
default: "default"
58+
probes:
59+
description: List of probe definitions used to check endpoint health.
60+
type: list
61+
elements: dict
62+
options:
63+
name:
64+
description: Name of the probe.
65+
port:
66+
description: Probe port for communicating the probe. Possible values range from 1 to 65535, inclusive.
67+
fail_count:
68+
description:
69+
- The number of probes which, if there is no response, will result in stopping further traffic from being delivered to the endpoint.
70+
- This value allows endpoints to be taken out of rotation faster or slower than the typical times used in Azure.
71+
default: '3'
72+
interval:
73+
description: Interval (in seconds) for how frequently to probe the endpoint for health status. Minimum value is '5'.
74+
default: '15'
75+
protocol:
76+
description:
77+
- Protocol of the endpoint to be probed. If 'Tcp' is specified, a received ACK is required for the probe to be successful.
78+
- If 'Http' or 'Https' is specified, a 200 OK response from the specified URL is required for the probe to be successful.
79+
request_path:
80+
description:
81+
- The URI used for requesting health status from the VM.
82+
- Path is required if protocol=Http or protocol=Https. Otherwise, it is not allowed.
83+
rules:
84+
description: List of load balancing rules.
85+
type: list
86+
elements: dict
87+
options:
88+
name:
89+
description: Name of the load balancing rule.
90+
probe:
91+
description: Name of the load balancer probe this rule should use.
92+
backend_address_pool:
93+
description: Name of backend address pool, where inbound traffic is randomly load balanced across the IPs in the pool.
94+
frontend_ip_configuration:
95+
description: Name of frontend ip configuration to apply rule to.
96+
backend_port:
97+
description:
98+
- The port used for internal connections on the endpoint.
99+
- Acceptable values are between 0 and 65535. Note that value 0 enables "Any Port".
100+
enable_floating_ip:
101+
description:
102+
- Configures a virtual machine's endpoint mapping to the Frontend IP address of the Load Balancer instead of backend instance's IP.
103+
frontend_port:
104+
description:
105+
- The port for the external endpoint.
106+
- Frontend port numbers must be unique across all rules within the load balancer.
107+
- Acceptable values are between 0 and 65534. Note that value 0 enables "Any Port".
108+
idle_timeout:
109+
description:
110+
- The timeout for the TCP idle connection.
111+
- The value can be set between 4 and 30 minutes.
112+
- This element is only used when the protocol is set to TCP.
113+
default: '4'
114+
load_distribution:
115+
description: Session persistence policy for this rule.
116+
default: 'no persistence'
117+
choices: ['SourceIP', 'SourceIPProtocol', 'no persistence']
118+
protocol:
119+
description: IP protocol for the rule.
120+
choices: ['Tcp', 'Udp', 'All']
121+
sku:
122+
description:
123+
- Load balancer SKU.
124+
- Will also be applied to the public ip generated for the load balancer.
125+
choices: ['Basic', 'Standard']
126+
tags:
127+
description: Metadata to the load balancer.
128+
type: dict

roles/azure_load_balancer_with_public_ip/tasks/main.yml

-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
---
2-
- name: Check azure_load_balancer_with_public_ip_operation validation
3-
ansible.builtin.fail:
4-
msg: Please provide azure_load_balancer_with_public_ip_operation as 'create' or 'delete'
5-
when: azure_load_balancer_with_public_ip_operation not in ['create', 'delete']
6-
7-
- name: Ensure resource group is defined
8-
ansible.builtin.fail:
9-
msg: Azure resource group must be defined as azure_load_balancer_with_public_ip_resource_group
10-
when: azure_load_balancer_with_public_ip_resource_group is not defined
11-
12-
- name: Ensure load balancer name is defined
13-
ansible.builtin.fail:
14-
msg: Azure load balancer name must be defined as azure_load_balancer_with_public_ip_load_balancer.name
15-
when: azure_load_balancer_with_public_ip_load_balancer.name is not defined
16-
172
- name: Get load balancer info
183
azure.azcollection.azure_rm_loadbalancer_info:
194
resource_group: "{{ azure_load_balancer_with_public_ip_resource_group }}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
argument_specs:
3+
main:
4+
version_added: 2.0.0
5+
short_description: A role to Create/Delete/Configure an Azure Network Interface.
6+
description:
7+
- A role to Create/Delete/Configure an Azure Network Interface.
8+
- This role requires an azure user account with valid permission.
9+
options:
10+
azure_manage_network_interface_operation:
11+
description:
12+
- Operation to perform
13+
default: "create"
14+
choices: ["create", "delete"]
15+
azure_manage_network_interface_resource_group:
16+
description:
17+
- Resource group.
18+
required: true
19+
azure_manage_network_interface_interface:
20+
description:
21+
- Object used to provide details for a network interface.
22+
type: dict
23+
options:
24+
name:
25+
description: Name of the network interface.
26+
required: true
27+
vnet_name:
28+
description:
29+
- Name of the existing azure virtual network where the network interface will reside.
30+
- Required when O(azure_manage_network_interface_operation=create).
31+
subnet_name:
32+
description:
33+
- Name of the existing azure subnet where the network interface will reside.
34+
- Required when O(azure_manage_network_interface_operation=create).
35+
security_group_name:
36+
description:
37+
- Name of the existing security group with which to associate the network interface.
38+
- If not provided, a default security group will be created when O(create_with_security_group=true).
39+
create_with_security_group:
40+
description: Whether or not a default security group should be created with the network interface.
41+
type: bool
42+
default: true
43+
os_type:
44+
description:
45+
- Determines any rules to be added to a network interface's default security group.
46+
- If O(os_type=Windows), a rule allowing RDP access will be added.
47+
- If O(os_type=Linux), a rule allowing SSH access will be added.
48+
enable_accelerated_networking:
49+
description: Set to V(yes) to enable accelerated networking.
50+
type: bool
51+
ip_forwarding:
52+
description: Set to V(yes) to enable ip forwarding.
53+
type: bool
54+
dns_servers:
55+
description: List of IP addresses representing which DNS servers the network interface should look up.
56+
type: list
57+
ip_configurations:
58+
description: List of IP configurations.
59+
type: list
60+
elements: dict
61+
options:
62+
name:
63+
description: Name of the IP configuration.
64+
required: true
65+
primary:
66+
description:
67+
- Set to V(yes) to make IP configuration the primary one.
68+
- The first IP configuration is by default set to O(primary=yes).
69+
application_security_groups:
70+
description: List of application security groups in which the IP configuration is included.
71+
type: list
72+
elements: str
73+
load_balancer_backend_address_pools:
74+
description: List of existing load balancer backend address pools in which the network interface will be load balanced.
75+
type: list
76+
elements: str
77+
private_ip_address:
78+
description: Private IP address for the IP configuration.
79+
private_ip_address_version:
80+
description: Ip version.
81+
default: 'IPv4'
82+
choices: ['IPv4', 'IPv6']
83+
private_ip_allocation_method:
84+
description: Ip allocation method.
85+
default: 'Dynamic'
86+
choices: ['Dynamic', 'Static']
87+
public_ip_address_name:
88+
description: Name of the existing public IP address to be assigned to the network interface.
89+
public_ip_allocation_method:
90+
description: Ip allocation method.
91+
default: 'Dynamic'
92+
choices: ['Dynamic', 'Static']
93+
tags:
94+
description: Metadata for the network interface.
95+
type: dict

roles/azure_manage_network_interface/tasks/main.yml

-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
---
2-
- name: Check operation validation
3-
ansible.builtin.fail:
4-
msg: Please provide azure_manage_network_interface_operation as 'create' or 'delete'
5-
when: azure_manage_network_interface_operation not in ['create', 'delete']
6-
7-
- name: Ensure resource group is defined
8-
ansible.builtin.fail:
9-
msg: Azure resource group name must be defined as azure_manage_network_interface_resource_group
10-
when: azure_manage_network_interface_resource_group is not defined
11-
12-
- name: Ensure network interface name is defined
13-
ansible.builtin.fail:
14-
msg: "Missing parameter: key 'name' not found in azure_manage_network_interface_interface"
15-
when: azure_manage_network_interface_interface.name is not defined
16-
172
- name: Get resource group info
183
azure.azcollection.azure_rm_resourcegroup_info:
194
name: "{{ azure_manage_network_interface_resource_group }}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
argument_specs:
3+
main:
4+
version_added: 2.0.0
5+
short_description: A role to Create/Delete/Configure an Azure Network Interface.
6+
description:
7+
- This role create/delete azure networking stack which include virtual network and add/delete a subnet.
8+
- It will also create the resource group on which the networking stack should be attached, if not existing.
9+
- This role requires an azure user account with valid permission.
10+
options:
11+
azure_manage_networking_stack_operation:
12+
description:
13+
- Operation to perform
14+
choices: ["create", "delete"]
15+
required: true
16+
azure_manage_networking_stack_delete_option:
17+
description:
18+
- When deleting created resources, this is used to specified wether to remove only the subnet, the virtual network or all (including resource group).
19+
default: 'all'
20+
choices: ['subnet', 'virtual_network', 'all']
21+
azure_manage_networking_stack_resource_group:
22+
description:
23+
- Resource group on which the networking stack should be attached.
24+
required: true
25+
azure_manage_networking_stack_virtual_network:
26+
description:
27+
- Name of the virtual network to create/delete.
28+
azure_manage_networking_stack_subnet:
29+
description:
30+
- Name of the subnet to create/delete.
31+
azure_manage_networking_stack_security_group:
32+
description:
33+
- Existing security group with which to associate the subnet.
34+
azure_manage_networking_stack_region:
35+
description: An Azure location for the virtual network to create.
36+
azure_manage_networking_stack_vnet_address_prefixes_cidr:
37+
description:
38+
- List of IPv4 address ranges for virtual network where each is formatted using CIDR notation.
39+
- Required when creating a new virtual network.
40+
type: list
41+
elements: str
42+
azure_manage_networking_stack_subnet_address_prefixes_cidr:
43+
description:
44+
- CIDR defining the IPv4 and IPv6 address space of the subnet.
45+
- Must be valid within the context of the virtual network.
46+
azure_manage_networking_stack_tags:
47+
description: Dictionary of string:string pairs to assign as metadata to the object.
48+
type: dict

0 commit comments

Comments
 (0)