Skip to content

Commit 98a93ad

Browse files
committed
Implement firewall template modules
1 parent 4367f0a commit 98a93ad

File tree

9 files changed

+522
-1
lines changed

9 files changed

+522
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Name | Description |
7070
[linode.cloud.domain_record_info](./docs/modules/domain_record_info.md)|Get info about a Linode Domain Records.|
7171
[linode.cloud.firewall_info](./docs/modules/firewall_info.md)|Get info about a Linode Firewall.|
7272
[linode.cloud.firewall_settings_info](./docs/modules/firewall_settings_info.md)|Get info about a Linode Firewall Settings.|
73+
[linode.cloud.firewall_template_info](./docs/modules/firewall_template_info.md)|Get info about a Linode Firewall Template.|
7374
[linode.cloud.image_info](./docs/modules/image_info.md)|Get info about a Linode Image.|
7475
[linode.cloud.instance_info](./docs/modules/instance_info.md)|Get info about a Linode Instance.|
7576
[linode.cloud.ip_info](./docs/modules/ip_info.md)|Get info about a Linode IP.|
@@ -106,6 +107,7 @@ Name | Description |
106107
[linode.cloud.domain_list](./docs/modules/domain_list.md)|List and filter on Domains.|
107108
[linode.cloud.event_list](./docs/modules/event_list.md)|List and filter on Events.|
108109
[linode.cloud.firewall_list](./docs/modules/firewall_list.md)|List and filter on Firewalls.|
110+
[linode.cloud.firewall_template_list](./docs/modules/firewall_template_list.md)|List and filter on Firewall Templates.|
109111
[linode.cloud.image_list](./docs/modules/image_list.md)|List and filter on Images.|
110112
[linode.cloud.instance_list](./docs/modules/instance_list.md)|List and filter on Instances.|
111113
[linode.cloud.instance_type_list](./docs/modules/instance_type_list.md)|**NOTE: This module has been deprecated in favor of `type_list`.**|
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# firewall_template_info
2+
3+
Get info about a Linode Firewall Template.
4+
5+
- [Minimum Required Fields](#minimum-required-fields)
6+
- [Examples](#examples)
7+
- [Parameters](#parameters)
8+
- [Return Values](#return-values)
9+
10+
## Minimum Required Fields
11+
| Field | Type | Required | Description |
12+
|-------------|-------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
13+
| `api_token` | `str` | **Required** | The Linode account personal access token. It is necessary to run the module. <br/>It can be exposed by the environment variable `LINODE_API_TOKEN` instead. <br/>See details in [Usage](https://github.com/linode/ansible_linode?tab=readme-ov-file#usage). |
14+
15+
## Examples
16+
17+
```yaml
18+
- name: Get info about a Firewall Template by slug
19+
linode.cloud.firewall_template_info:
20+
slug: public
21+
```
22+
23+
24+
## Parameters
25+
26+
| Field | Type | Required | Description |
27+
|-----------|------|----------|------------------------------------------------------------------------------|
28+
| `slug` | <center>`str`</center> | <center>**Required**</center> | The Slug of the Firewall Template to resolve. |
29+
30+
## Return Values
31+
32+
- `firewall_template` - The returned Firewall Template.
33+
34+
- Sample Response:
35+
```json
36+
37+
{
38+
"rules": {
39+
"inbound": [
40+
{
41+
"action": "ACCEPT",
42+
"addresses": {
43+
"ipv4": [
44+
"0.0.0.0/0"
45+
],
46+
"ipv6": [
47+
"::/0"
48+
]
49+
},
50+
"description": "Accept inbound SSH",
51+
"label": "accept-inbound-ssh",
52+
"ports": "22",
53+
"protocol": "TCP"
54+
},
55+
{
56+
"action": "ACCEPT",
57+
"addresses": {
58+
"ipv4": [
59+
"0.0.0.0/0"
60+
],
61+
"ipv6": [
62+
"::/0"
63+
]
64+
},
65+
"description": "Accept inbound ICMP",
66+
"label": "accept-inbound-icmp",
67+
"protocol": "ICMP"
68+
}
69+
],
70+
"inbound_policy": "DROP",
71+
"outbound": [],
72+
"outbound_policy": "ACCEPT"
73+
},
74+
"slug": "public"
75+
}
76+
```
77+
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-firewall-template) for a list of returned fields
78+
79+
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# firewall_template_list
2+
3+
List and filter on Firewall Templates.
4+
5+
- [Minimum Required Fields](#minimum-required-fields)
6+
- [Examples](#examples)
7+
- [Parameters](#parameters)
8+
- [Return Values](#return-values)
9+
10+
## Minimum Required Fields
11+
| Field | Type | Required | Description |
12+
|-------------|-------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
13+
| `api_token` | `str` | **Required** | The Linode account personal access token. It is necessary to run the module. <br/>It can be exposed by the environment variable `LINODE_API_TOKEN` instead. <br/>See details in [Usage](https://github.com/linode/ansible_linode?tab=readme-ov-file#usage). |
14+
15+
## Examples
16+
17+
```yaml
18+
- name: List all of the firewall templates
19+
linode.cloud.firewall_template_list: {}
20+
```
21+
22+
23+
## Parameters
24+
25+
| Field | Type | Required | Description |
26+
|-----------|------|----------|------------------------------------------------------------------------------|
27+
| `order` | <center>`str`</center> | <center>Optional</center> | The order to list Firewall Templates in. **(Choices: `desc`, `asc`; Default: `asc`)** |
28+
| `order_by` | <center>`str`</center> | <center>Optional</center> | The attribute to order Firewall Templates by. |
29+
| [`filters` (sub-options)](#filters) | <center>`list`</center> | <center>Optional</center> | A list of filters to apply to the resulting Firewall Templates. |
30+
| `count` | <center>`int`</center> | <center>Optional</center> | The number of Firewall Templates to return. If undefined, all results will be returned. |
31+
32+
### filters
33+
34+
| Field | Type | Required | Description |
35+
|-----------|------|----------|------------------------------------------------------------------------------|
36+
| `name` | <center>`str`</center> | <center>**Required**</center> | The name of the field to filter on. Valid filterable fields can be found [here](https://techdocs.akamai.com/linode-api/reference/get-firewall-templates). |
37+
| `values` | <center>`list`</center> | <center>**Required**</center> | A list of values to allow for this field. Fields will pass this filter if at least one of these values matches. |
38+
39+
## Return Values
40+
41+
- `firewall_templates` - The returned Firewall Templates.
42+
43+
- Sample Response:
44+
```json
45+
46+
[
47+
{
48+
"rules": {
49+
"inbound": [
50+
{
51+
"action": "ACCEPT",
52+
"addresses": {
53+
"ipv4": [
54+
"0.0.0.0/0"
55+
],
56+
"ipv6": [
57+
"::/0"
58+
]
59+
},
60+
"description": "Accept inbound SSH",
61+
"label": "accept-inbound-ssh",
62+
"ports": "22",
63+
"protocol": "TCP"
64+
},
65+
{
66+
"action": "ACCEPT",
67+
"addresses": {
68+
"ipv4": [
69+
"0.0.0.0/0"
70+
],
71+
"ipv6": [
72+
"::/0"
73+
]
74+
},
75+
"description": "Accept inbound ICMP",
76+
"label": "accept-inbound-icmp",
77+
"protocol": "ICMP"
78+
},
79+
{
80+
"action": "ACCEPT",
81+
"addresses": {
82+
"ipv4": [
83+
"10.0.0.0/8",
84+
"192.168.0.0/17",
85+
"172.16.0.0/12"
86+
]
87+
},
88+
"description": "Accept inbound RFC-1918",
89+
"label": "accept-inbound-rfc1918",
90+
"ports": "1-65535",
91+
"protocol": "TCP"
92+
},
93+
{
94+
"action": "ACCEPT",
95+
"addresses": {
96+
"ipv4": [
97+
"10.0.0.0/8",
98+
"192.168.0.0/17",
99+
"172.16.0.0/12"
100+
]
101+
},
102+
"description": "Accept inbound RFC-1918",
103+
"label": "accept-inbound-rfc1918",
104+
"ports": "1-65535",
105+
"protocol": "UDP"
106+
}
107+
],
108+
"inbound_policy": "DROP",
109+
"outbound": [],
110+
"outbound_policy": "ACCEPT"
111+
},
112+
"slug": "vpc"
113+
},
114+
{
115+
"rules": {
116+
"inbound": [
117+
{
118+
"action": "ACCEPT",
119+
"addresses": {
120+
"ipv4": [
121+
"0.0.0.0/0"
122+
],
123+
"ipv6": [
124+
"::/0"
125+
]
126+
},
127+
"description": "Accept inbound SSH",
128+
"label": "accept-inbound-ssh",
129+
"ports": "22",
130+
"protocol": "TCP"
131+
},
132+
{
133+
"action": "ACCEPT",
134+
"addresses": {
135+
"ipv4": [
136+
"0.0.0.0/0"
137+
],
138+
"ipv6": [
139+
"::/0"
140+
]
141+
},
142+
"description": "Accept inbound ICMP",
143+
"label": "accept-inbound-icmp",
144+
"protocol": "ICMP"
145+
}
146+
],
147+
"inbound_policy": "DROP",
148+
"outbound": [],
149+
"outbound_policy": "ACCEPT"
150+
},
151+
"slug": "public"
152+
}
153+
]
154+
155+
```
156+
- See the [Linode API response documentation](https://techdocs.akamai.com/linode-api/reference/get-firewall-templates) for a list of returned fields
157+
158+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"""Documentation fragments for the firewall_template_info module"""
2+
3+
specdoc_examples = ['''
4+
- name: Get info about a Firewall Template by slug
5+
linode.cloud.firewall_template_info:
6+
slug: public''']
7+
8+
result_firewall_template_samples = ['''
9+
{
10+
"rules": {
11+
"inbound": [
12+
{
13+
"action": "ACCEPT",
14+
"addresses": {
15+
"ipv4": [
16+
"0.0.0.0/0"
17+
],
18+
"ipv6": [
19+
"::/0"
20+
]
21+
},
22+
"description": "Accept inbound SSH",
23+
"label": "accept-inbound-ssh",
24+
"ports": "22",
25+
"protocol": "TCP"
26+
},
27+
{
28+
"action": "ACCEPT",
29+
"addresses": {
30+
"ipv4": [
31+
"0.0.0.0/0"
32+
],
33+
"ipv6": [
34+
"::/0"
35+
]
36+
},
37+
"description": "Accept inbound ICMP",
38+
"label": "accept-inbound-icmp",
39+
"protocol": "ICMP"
40+
}
41+
],
42+
"inbound_policy": "DROP",
43+
"outbound": [],
44+
"outbound_policy": "ACCEPT"
45+
},
46+
"slug": "public"
47+
}''']

0 commit comments

Comments
 (0)