-
Notifications
You must be signed in to change notification settings - Fork 1
/
f5bigip_ltm_monitor_wap.py
193 lines (177 loc) · 6.57 KB
/
f5bigip_ltm_monitor_wap.py
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2016 Eric Jacob <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"supported_by": "community",
}
DOCUMENTATION = """
---
module: f5bigip_ltm_monitor_wap
short_description: BIG-IP ltm monitor wap module
description:
- Configures a Wireless Application Protocol (WAP) monitor.
version_added: "1.0.0" # of erjac77.f5 role
author:
- "Gabriel Fortin (@GabrielFortin)"
options:
accounting_node:
description:
- Specifies the RADIUS server that provides authentication for the WAP target.
accounting_port:
description:
- Specifies the port that the monitor uses for RADIUS accounting.
call_id:
description:
- Specifies the 11-digit phone number for the RADIUS server.
debug:
description:
- Specifies whether the monitor sends error messages and additional information to a log file created and
labeled specifically for this monitor.
default: no
choices: ['no', 'yes']
defaults_from:
description:
- Specifies the name of the monitor from which you want your custom monitor to inherit settings.
default: wap
destination:
description:
- Specifies the IP address and service port of the resource that is the destination of this monitor.
framed_address:
description:
- Specifies the RADIUS framed IP address
interval:
description:
- Specifies, in seconds, the frequency at which the system issues the monitor check when either the resource
is down or the status of the resource is unknown.
default: 10
manual_resume:
description:
- Specifies whether the system automatically changes the status of a resource to up at the next successful
monitor check.
default: disabled
choices: ['disabled', 'enabled']
recv:
description:
- Specifies the text string that the monitor looks for in the returned resource.
secret:
description:
- Specifies the password the monitor needs to access the resource.
send:
description:
- Specifies the text string that the monitor sends to the target object.
default: GET /
server_id:
description:
- Specifies the RADIUS NAS-ID for this system when configuring a RADIUS server.
session_id:
description:
- Specifies the RADIUS session identification number when configuring a RADIUS server.
time_until_up:
description:
- Specifies the amount of time, in seconds, after the first successful response before a node is marked up.
default: 0
timeout:
description:
- Specifies the number of seconds the target has in which to respond to the monitor request.
default: 31
up_interval:
description:
- Specifies, in seconds, the frequency at which the system issues the monitor check when the resource is up.
default: 0
extends_documentation_fragment:
- f5_common
- f5_app_service
- f5_description
- f5_name
- f5_partition
- f5_state
"""
EXAMPLES = """
- name: Create LTM Monitor WAP
f5bigip_ltm_monitor_wap:
provider:
server: "{{ ansible_host }}"
server_port: "{{ http_port | default(443) }}"
user: "{{ http_user }}"
password: "{{ http_pass }}"
validate_certs: false
name: my_wap_monitor
partition: Common
description: My wap monitor
state: present
delegate_to: localhost
"""
RETURN = """ # """
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.erjac77.network.f5.common import F5_ACTIVATION_CHOICES
from ansible.module_utils.erjac77.network.f5.common import F5_NAMED_OBJ_ARGS
from ansible.module_utils.erjac77.network.f5.common import F5_POLAR_CHOICES
from ansible.module_utils.erjac77.network.f5.common import F5_PROVIDER_ARGS
from ansible.module_utils.erjac77.network.f5.bigip import F5BigIpNamedObject
class ModuleParams(object):
@property
def argument_spec(self):
argument_spec = dict(
accounting_node=dict(type="str"),
accounting_port=dict(type="int"),
app_service=dict(type="str"),
call_id=dict(type="str"),
debug=dict(type="str", choices=F5_POLAR_CHOICES),
defaults_from=dict(type="str"),
description=dict(type="str"),
destination=dict(type="str"),
framed_address=dict(type="str"),
interval=dict(type="int"),
manual_resume=dict(type="str", choices=F5_ACTIVATION_CHOICES),
recv=dict(type="str"),
secret=dict(type="str"),
send=dict(type="str"),
server_id=dict(type="str"),
session_id=dict(type="str"),
time_until_up=dict(type="int"),
timeout=dict(type="int"),
up_interval=dict(type="int"),
)
argument_spec.update(F5_PROVIDER_ARGS)
argument_spec.update(F5_NAMED_OBJ_ARGS)
return argument_spec
@property
def supports_check_mode(self):
return True
class F5BigIpLtmMonitorWap(F5BigIpNamedObject):
def _set_crud_methods(self):
self._methods = {
"create": self._api.tm.ltm.monitor.waps.wap.create,
"read": self._api.tm.ltm.monitor.waps.wap.load,
"update": self._api.tm.ltm.monitor.waps.wap.update,
"delete": self._api.tm.ltm.monitor.waps.wap.delete,
"exists": self._api.tm.ltm.monitor.waps.wap.exists,
}
def main():
params = ModuleParams()
module = AnsibleModule(
argument_spec=params.argument_spec,
supports_check_mode=params.supports_check_mode,
)
try:
obj = F5BigIpLtmMonitorWap(check_mode=module.check_mode, **module.params)
result = obj.flush()
module.exit_json(**result)
except Exception as exc:
module.fail_json(msg=str(exc))
if __name__ == "__main__":
main()