mirror of https://github.com/ansible/ansible.git
Updates module utils for f5 (#34660)
These module utils are a refactor of the legacy ones and, in addition, there are several new methods and classes to support f5 modules going forwardpull/34671/head
parent
d1846425db
commit
70e49b9243
@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2017 F5 Networks Inc.
|
||||
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
try:
|
||||
from f5.bigip import ManagementRoot
|
||||
from icontrol.exceptions import iControlUnexpectedHTTPError
|
||||
HAS_F5SDK = True
|
||||
except ImportError:
|
||||
HAS_F5SDK = False
|
||||
|
||||
try:
|
||||
from library.module_utils.network.f5.common import F5BaseClient
|
||||
except ImportError:
|
||||
from ansible.module_utils.network.f5.common import F5BaseClient
|
||||
|
||||
|
||||
class F5Client(F5BaseClient):
|
||||
@property
|
||||
def api(self):
|
||||
result = ManagementRoot(
|
||||
self.params['server'],
|
||||
self.params['user'],
|
||||
self.params['password'],
|
||||
port=self.params['server_port'],
|
||||
verify=self.params['validate_certs'],
|
||||
token='tmos'
|
||||
)
|
||||
return result
|
@ -1,28 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2017 F5 Networks Inc.
|
||||
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
try:
|
||||
from f5.bigip import ManagementRoot as BigipManagementRoot
|
||||
from f5.bigip.contexts import TransactionContextManager as BigipTransactionContextManager
|
||||
from f5.bigiq import ManagementRoot as BigiqManagementRoot
|
||||
from f5.iworkflow import ManagementRoot as IworkflowManagementRoot
|
||||
from icontrol.exceptions import iControlUnexpectedHTTPError
|
||||
HAS_F5SDK = True
|
||||
except ImportError:
|
||||
HAS_F5SDK = False
|
||||
|
||||
|
||||
def cleanup_tokens(client):
|
||||
try:
|
||||
resource = client.api.shared.authz.tokens_s.token.load(
|
||||
name=client.api.icrs.token
|
||||
)
|
||||
resource.delete()
|
||||
except Exception:
|
||||
pass
|
@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2017 F5 Networks Inc.
|
||||
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
try:
|
||||
from f5.bigiq import ManagementRoot
|
||||
from icontrol.exceptions import iControlUnexpectedHTTPError
|
||||
HAS_F5SDK = True
|
||||
except ImportError:
|
||||
HAS_F5SDK = False
|
||||
|
||||
from ansible.module_utils.network.f5.common import F5BaseClient
|
||||
|
||||
|
||||
class F5Client(F5BaseClient):
|
||||
@property
|
||||
def api(self):
|
||||
result = ManagementRoot(
|
||||
self.params['server'],
|
||||
self.params['user'],
|
||||
self.params['password'],
|
||||
port=self.params['server_port'],
|
||||
verify=self.params['validate_certs'],
|
||||
token='local'
|
||||
)
|
||||
return result
|
@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2017 F5 Networks Inc.
|
||||
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
try:
|
||||
from f5.iworkflow import ManagementRoot
|
||||
from icontrol.exceptions import iControlUnexpectedHTTPError
|
||||
HAS_F5SDK = True
|
||||
except ImportError:
|
||||
HAS_F5SDK = False
|
||||
|
||||
from ansible.module_utils.network.f5.common import F5BaseClient
|
||||
|
||||
|
||||
class F5Client(F5BaseClient):
|
||||
@property
|
||||
def api(self):
|
||||
result = ManagementRoot(
|
||||
self.params['server'],
|
||||
self.params['user'],
|
||||
self.params['password'],
|
||||
port=self.params['server_port'],
|
||||
verify=self.params['validate_certs'],
|
||||
token='local'
|
||||
)
|
||||
return result
|
Loading…
Reference in New Issue