-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathf5-management-ip-rule.yml
55 lines (53 loc) · 1.54 KB
/
f5-management-ip-rule.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
- name: Base VE config
hosts: "{{ target_hosts | default('f5') }}"
# connection: local
gather_facts: False
vars:
ntp_var: [1.1.1.1, 2.2.2.2, 3.3.3.3]
device: 13.239.56.250
device_port: 8443
api_url: mgmt/tm/security/firewall/management-ip-rules/rules
username: admin
password: admin
tasks:
- name: Get all current management firewall rule
uri:
url: https://{{device}}:{{device_port}}/{{ api_url }}
user: "{{ username }}"
password: "{{ password }}"
method: GET
validate_certs: no
delegate_to: localhost
register: output
- debug: var=output
- name: create management firewall rule
uri:
url: https://{{device}}:{{device_port}}/{{ api_url }}/test_rule
user: "{{ username }}"
password: "{{ password }}"
body:
{
"place-after": "last",
"fullPath": "test_rule",
"action": "accept",
"ipProtocol": "any",
"log": "yes",
"ruleNumber": "2",
"status": "enabled",
"destination": {},
"source": {
"addresses": [
{
"name": "10.1.0.0-10.1.1.0"
}
]
}
}
method: POST
headers:
Content-Type: application/json
body_format: json
validate_certs: no
delegate_to: localhost
register: post_output
- debug: var=post_output