Skip to content

Commit a9efebb

Browse files
committed
Add argument_specs.yml for role vars validation
1 parent f324fd4 commit a9efebb

File tree

11 files changed

+505
-76
lines changed

11 files changed

+505
-76
lines changed
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 `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 `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 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 `os_type=Windows`, a rule allowing RDP access will be added.
47+
- If `os_type=Linux`, a rule allowing SSH access will be added.
48+
enable_accelerated_networking:
49+
description: Set to 'yes' to enable accelerated networking.
50+
type: bool
51+
ip_forwarding:
52+
description: Set to '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 'yes' to make IP configuration the primary one.
68+
- The first IP configuration is by default set to 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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
argument_specs:
3+
main:
4+
version_added: 2.0.0
5+
short_description: A role to Create/Delete/Configure an Azure Database for PostgreSQL server.
6+
description:
7+
- A role to Create/Delete/Configure an Azure Database for PostgreSQL server.
8+
- This role requires an azure user account with valid permission.
9+
options:
10+
azure_manage_postgresql_operation:
11+
description: Operation to perform.
12+
default: "create"
13+
choices: ["create", "delete"]
14+
azure_manage_postgresql_delete_option:
15+
description:
16+
- used with `azure_manage_postgresql_operation` set to delete.
17+
- This option specifies wether to delete all resources including resource group and PostgreSQL server, or only the postgresql server.
18+
- If not specified only the firewall rules and/or the configuration settings and/or the database instances defined using dedicated variables will be removed from the PostgreSQL Server.
19+
choices: ['all', 'server']
20+
azure_manage_postgresql_resource_group:
21+
description:
22+
- Resource group on/from which the Database server will be created/deleted.
23+
required: true
24+
azure_manage_postgresql_region:
25+
description: An Azure location for the resources.
26+
azure_manage_postgresql_tags:
27+
description: Dictionary of string:string pairs to assign as metadata to the object.
28+
type: dict
29+
elements: str
30+
azure_manage_postgresql_postgresql_name:
31+
description: The name of the Server.
32+
azure_manage_postgresql_postgresql_sku:
33+
description: The SKU (pricing tier) of the server.
34+
required: true
35+
type: dict
36+
options:
37+
name:
38+
description:
39+
- The name of the SKU, typically, tier + family + cores, for example B_Gen4_1, GP_Gen5_8.
40+
tier:
41+
description: The tier of the particular SKU. Valid values are Basic, Standard.
42+
capacity:
43+
description: The scale up/out capacity, representing the server's compute units.
44+
size:
45+
description: The size code, to be interpreted by resource as appropriate.
46+
azure_manage_postgresql_postgresql_storage_mb:
47+
description: The maximum storage allowed for a server.
48+
azure_manage_postgresql_postgresql_geo_redundant_backup:
49+
description:
50+
- Choose between locally redundant(default) or geo-redundant backup.
51+
- This cannot be updated after first deployment.
52+
default: false
53+
type: bool
54+
azure_manage_postgresql_postgresql_backup_retention_days:
55+
description: Backup retention period between 7 and 35 days.
56+
default: '7'
57+
azure_manage_postgresql_postgresql_version:
58+
description: Server version.
59+
choices: ['9.5', '9.6', '10', '11']
60+
default: '9.5'
61+
azure_manage_postgresql_postgresql_enforce_ssl:
62+
description: Enable SSL enforcement.
63+
default: False
64+
type: bool
65+
azure_manage_postgresql_postgresql_storage_autogrow:
66+
description: Enable storage autogrow.
67+
default: False
68+
type: bool
69+
azure_manage_postgresql_postgresql_admin_username:
70+
description:
71+
- The administrator's login name of a server.
72+
- Can only be specified when the server is being created (and is required for creation).
73+
azure_manage_postgresql_postgresql_admin_password:
74+
description:
75+
- The password of the administrator login.
76+
- When this is not defined, the role will generated a password that can be read later in the variable name.
77+
azure_manage_postgresql_postgresql_create_mode:
78+
description:
79+
- Create mode of SQL Server.
80+
- restore from geo redundant (geo_restore), or restore from point in time (point_in_time_restore).
81+
choices: ['default, geo_restore', 'point_in_time_restore']
82+
default: 'default'
83+
azure_manage_postgresql_postgresql_source_server_id:
84+
description:
85+
- Id of the source server if azure_manage_postgresql_postgresql_create_mode is set to default.
86+
azure_manage_postgresql_postgresql_restore_point_in_time:
87+
description:
88+
- Restore point creation time (ISO8601 format), specifying the time to restore from.
89+
- Required if azure_manage_postgresql_postgresql_create_mode is set to point_in_time_restore.
90+
azure_manage_postgresql_postgresql_settings:
91+
description:
92+
- list of configuration settings for PostgreSQL Server.
93+
type: list
94+
elements: dict
95+
options:
96+
name:
97+
description: setting name.
98+
value:
99+
description: value of the setting.
100+
azure_manage_postgresql_postgresql_firewall_rules:
101+
description: list of firewall rule to add/remove to the PostgreSQL Server.
102+
type: list
103+
elements: dict
104+
options:
105+
name:
106+
description: The name of the PostgreSQL firewall rule.
107+
start_ip_address:
108+
description:
109+
- The start IP address of the PostgreSQL firewall rule.
110+
- Must be IPv4 format.
111+
end_ip_address:
112+
description:
113+
- The end IP address of the PostgreSQL firewall rule.
114+
- Must be IPv4 format.
115+
azure_manage_postgresql_postgresql_database_instances:
116+
description:
117+
- list of database instances to create/delete on/from the PostgreSQL Server.
118+
type: list
119+
elements: dict
120+
options:
121+
name:
122+
description: The name of the PostgreSQL database instance.
123+
charset:
124+
description:
125+
- The charset of the database. Check PostgreSQL documentation for possible values.
126+
- This is only set on creation, use force to recreate a database if the values don't match.
127+
collation:
128+
description:
129+
-The collation of the database.
130+
- Check PostgreSQL documentation. This is only set on creation, use force to recreate a database if the values don't match.
131+
force:
132+
description:
133+
- When set to `True`, will delete and recreate the existing PostgreSQL database if any of the properties don't match what is set.
134+
- Ignore when operation is set to `delete`.
135+
type: bool

roles/azure_manage_postgresql/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_postgresql_operation as 'create' or 'delete'
5-
when: azure_manage_postgresql_operation not in ['create', 'delete']
6-
7-
- name: Check Azure resource group
8-
ansible.builtin.fail:
9-
msg: Azure resource group must be defined as azure_manage_postgresql_resource_group
10-
when: azure_manage_postgresql_resource_group is not defined
11-
12-
- name: Check Azure PostgreSQL server name
13-
ansible.builtin.fail:
14-
msg: Azure Postgresql server name must be defined as azure_manage_postgresql_postgresql_name
15-
when: azure_manage_postgresql_postgresql_name is not defined
16-
172
- name: Get server info
183
azure.azcollection.azure_rm_postgresqlserver_info:
194
resource_group: "{{ azure_manage_postgresql_resource_group }}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
argument_specs:
3+
main:
4+
version_added: 2.0.0
5+
short_description: A role to manage Azure Resource Group. User can create or delete resource group.
6+
description:
7+
- A role to manage Azure Resource Group. User can create or delete resource group.
8+
- This role requires an azure user account with valid permission.
9+
options:
10+
azure_manage_resource_group_operation:
11+
description: Operation to perform.
12+
choices: ["create", "delete"]
13+
required: true
14+
azure_manage_resource_group_name:
15+
description: Resource group to create or delete.
16+
required: true
17+
azure_manage_resource_group_region:
18+
description: An Azure location for the resource group to create.
19+
azure_manage_resource_group_lock_resource_group:
20+
description: If set to 'true', will lock the resource group created.
21+
type: bool
22+
azure_manage_resource_group_tags:
23+
description: Dictionary of string:string pairs to assign as metadata to the object.
24+
type: dict
25+
azure_manage_resource_group_force_delete_nonempty:
26+
description: Remove a resource group and all associated resources.
27+
azure_manage_resource_group_force_delete_locked:
28+
description: Remove a resource group even if it is locked.
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
11
---
2-
- name: Check azure_manage_resource_group_operation validation
3-
ansible.builtin.fail:
4-
msg: Please provide azure_manage_resource_group_operation as 'create' or 'delete'
5-
when: azure_manage_resource_group_operation not in ['create', 'delete']
6-
7-
- name: Check Resource group name
8-
ansible.builtin.fail:
9-
msg: Azure Resource group name must be defined as azure_manage_resource_group_name
10-
when: azure_manage_resource_group_name is not defined
11-
122
- name: Create or delete resource group
133
ansible.builtin.include_tasks: "{{ azure_manage_resource_group_operation }}.yml"

0 commit comments

Comments
 (0)