Skip to content

Commit f324fd4

Browse files
committed
Add arguments_specs to roles
1 parent cfe72d5 commit f324fd4

File tree

2 files changed

+128
-15
lines changed

2 files changed

+128
-15
lines changed
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 `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 }}"

0 commit comments

Comments
 (0)