mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Removes bigip_irule from the skip file (#32509)
This commit is contained in:
parent
d166bba126
commit
ab71a9de14
3 changed files with 72 additions and 67 deletions
|
@ -4,14 +4,18 @@
|
||||||
# Copyright (c) 2017 F5 Networks Inc.
|
# Copyright (c) 2017 F5 Networks Inc.
|
||||||
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# 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
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: bigip_irule
|
module: bigip_irule
|
||||||
short_description: Manage iRules across different modules on a BIG-IP.
|
short_description: Manage iRules across different modules on a BIG-IP
|
||||||
description:
|
description:
|
||||||
- Manage iRules across different modules on a BIG-IP.
|
- Manage iRules across different modules on a BIG-IP.
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
|
@ -45,6 +49,11 @@ options:
|
||||||
choices:
|
choices:
|
||||||
- present
|
- present
|
||||||
- absent
|
- absent
|
||||||
|
partition:
|
||||||
|
description:
|
||||||
|
- Device partition to manage resources on.
|
||||||
|
default: Common
|
||||||
|
version_added: 2.5
|
||||||
notes:
|
notes:
|
||||||
- Requires the f5-sdk Python package on the host. This is as easy as
|
- Requires the f5-sdk Python package on the host. This is as easy as
|
||||||
pip install f5-sdk.
|
pip install f5-sdk.
|
||||||
|
@ -55,41 +64,41 @@ author:
|
||||||
- Tim Rupp (@caphrim007)
|
- Tim Rupp (@caphrim007)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r'''
|
||||||
- name: Add the iRule contained in template irule.tcl to the LTM module
|
- name: Add the iRule contained in template irule.tcl to the LTM module
|
||||||
bigip_irule:
|
bigip_irule:
|
||||||
content: "{{ lookup('template', 'irule.tcl') }}"
|
content: "{{ lookup('template', 'irule.tcl') }}"
|
||||||
module: "ltm"
|
module: ltm
|
||||||
name: "MyiRule"
|
name: MyiRule
|
||||||
password: "secret"
|
password: secret
|
||||||
server: "lb.mydomain.com"
|
server: lb.mydomain.com
|
||||||
state: "present"
|
state: present
|
||||||
user: "admin"
|
user: admin
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Add the iRule contained in static file irule.tcl to the LTM module
|
- name: Add the iRule contained in static file irule.tcl to the LTM module
|
||||||
bigip_irule:
|
bigip_irule:
|
||||||
module: "ltm"
|
module: ltm
|
||||||
name: "MyiRule"
|
name: MyiRule
|
||||||
password: "secret"
|
password: secret
|
||||||
server: "lb.mydomain.com"
|
server: lb.mydomain.com
|
||||||
src: "irule.tcl"
|
src: irule.tcl
|
||||||
state: "present"
|
state: present
|
||||||
user: "admin"
|
user: admin
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r'''
|
||||||
module:
|
module:
|
||||||
description: The module that the iRule was added to
|
description: The module that the iRule was added to
|
||||||
returned: changed and success
|
returned: changed and success
|
||||||
type: string
|
type: string
|
||||||
sample: "gtm"
|
sample: gtm
|
||||||
src:
|
src:
|
||||||
description: The filename that included the iRule source
|
description: The filename that included the iRule source
|
||||||
returned: changed and success, when provided
|
returned: changed and success, when provided
|
||||||
type: string
|
type: string
|
||||||
sample: "/opt/src/irules/example1.tcl"
|
sample: /opt/src/irules/example1.tcl
|
||||||
content:
|
content:
|
||||||
description: The content of the iRule that was managed
|
description: The content of the iRule that was managed
|
||||||
returned: changed and success
|
returned: changed and success
|
||||||
|
@ -97,13 +106,17 @@ content:
|
||||||
sample: "when LB_FAILED { set wipHost [LB::server addr] }"
|
sample: "when LB_FAILED { set wipHost [LB::server addr] }"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.f5_utils import (
|
import os
|
||||||
AnsibleF5Client,
|
|
||||||
AnsibleF5Parameters,
|
from ansible.module_utils.f5_utils import AnsibleF5Client
|
||||||
HAS_F5SDK,
|
from ansible.module_utils.f5_utils import AnsibleF5Parameters
|
||||||
F5ModuleError,
|
from ansible.module_utils.f5_utils import HAS_F5SDK
|
||||||
iControlUnexpectedHTTPError
|
from ansible.module_utils.f5_utils import F5ModuleError
|
||||||
)
|
|
||||||
|
try:
|
||||||
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||||
|
except ImportError:
|
||||||
|
HAS_F5SDK = False
|
||||||
|
|
||||||
|
|
||||||
class Parameters(AnsibleF5Parameters):
|
class Parameters(AnsibleF5Parameters):
|
||||||
|
@ -146,8 +159,11 @@ class Parameters(AnsibleF5Parameters):
|
||||||
@property
|
@property
|
||||||
def content(self):
|
def content(self):
|
||||||
if self._values['content'] is None:
|
if self._values['content'] is None:
|
||||||
return None
|
result = self.src_content
|
||||||
return str(self._values['content']).strip()
|
else:
|
||||||
|
result = self._values['content']
|
||||||
|
|
||||||
|
return str(result).strip()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def src(self):
|
def src(self):
|
||||||
|
@ -155,13 +171,15 @@ class Parameters(AnsibleF5Parameters):
|
||||||
return None
|
return None
|
||||||
return self._values['src']
|
return self._values['src']
|
||||||
|
|
||||||
@src.setter
|
@property
|
||||||
def src(self, value):
|
def src_content(self):
|
||||||
if value:
|
if not os.path.exists(self._values['src']):
|
||||||
self._values['src'] = value
|
raise F5ModuleError(
|
||||||
with open(value) as f:
|
"The specified 'src' was not found."
|
||||||
|
)
|
||||||
|
with open(self._values['src']) as f:
|
||||||
result = f.read()
|
result = f.read()
|
||||||
self._values['content'] = result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
|
@ -288,7 +306,7 @@ class LtmManager(BaseManager):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def update_on_device(self):
|
def update_on_device(self):
|
||||||
params = self.want.api_params()
|
params = self.changes.api_params()
|
||||||
resource = self.client.api.tm.ltm.rules.rule.load(
|
resource = self.client.api.tm.ltm.rules.rule.load(
|
||||||
name=self.want.name,
|
name=self.want.name,
|
||||||
partition=self.want.partition
|
partition=self.want.partition
|
||||||
|
@ -344,7 +362,7 @@ class GtmManager(BaseManager):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def update_on_device(self):
|
def update_on_device(self):
|
||||||
params = self.want.api_params()
|
params = self.changes.api_params()
|
||||||
resource = self.client.api.tm.gtm.rules.rule.load(
|
resource = self.client.api.tm.gtm.rules.rule.load(
|
||||||
name=self.want.name,
|
name=self.want.name,
|
||||||
partition=self.want.partition
|
partition=self.want.partition
|
||||||
|
|
|
@ -14,7 +14,6 @@ lib/ansible/modules/cloud/webfaction/webfaction_mailbox.py
|
||||||
lib/ansible/modules/cloud/webfaction/webfaction_site.py
|
lib/ansible/modules/cloud/webfaction/webfaction_site.py
|
||||||
lib/ansible/modules/clustering/consul_acl.py
|
lib/ansible/modules/clustering/consul_acl.py
|
||||||
lib/ansible/modules/network/cloudengine/ce_file_copy.py
|
lib/ansible/modules/network/cloudengine/ce_file_copy.py
|
||||||
lib/ansible/modules/network/f5/bigip_irule.py
|
|
||||||
lib/ansible/modules/network/f5/bigip_pool.py
|
lib/ansible/modules/network/f5/bigip_pool.py
|
||||||
lib/ansible/modules/network/f5/bigip_provision.py
|
lib/ansible/modules/network/f5/bigip_provision.py
|
||||||
lib/ansible/modules/network/f5/bigip_qkview.py
|
lib/ansible/modules/network/f5/bigip_qkview.py
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright 2017 F5 Networks Inc.
|
# Copyright (c) 2017 F5 Networks Inc.
|
||||||
#
|
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public Liccense for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
@ -41,6 +27,7 @@ try:
|
||||||
from library.bigip_irule import ArgumentSpec
|
from library.bigip_irule import ArgumentSpec
|
||||||
from library.bigip_irule import GtmManager
|
from library.bigip_irule import GtmManager
|
||||||
from library.bigip_irule import LtmManager
|
from library.bigip_irule import LtmManager
|
||||||
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
from ansible.modules.network.f5.bigip_irule import Parameters
|
from ansible.modules.network.f5.bigip_irule import Parameters
|
||||||
|
@ -48,6 +35,7 @@ except ImportError:
|
||||||
from ansible.modules.network.f5.bigip_irule import ArgumentSpec
|
from ansible.modules.network.f5.bigip_irule import ArgumentSpec
|
||||||
from ansible.modules.network.f5.bigip_irule import GtmManager
|
from ansible.modules.network.f5.bigip_irule import GtmManager
|
||||||
from ansible.modules.network.f5.bigip_irule import LtmManager
|
from ansible.modules.network.f5.bigip_irule import LtmManager
|
||||||
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
||||||
|
|
||||||
|
@ -213,7 +201,7 @@ class TestManager(unittest.TestCase):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
name='foo',
|
name='foo',
|
||||||
module='gtm',
|
module='gtm',
|
||||||
src='/path/to/irules/foo.tcl',
|
src='{0}/create_ltm_irule.tcl'.format(fixture_path),
|
||||||
partition='Common',
|
partition='Common',
|
||||||
server='localhost',
|
server='localhost',
|
||||||
password='password',
|
password='password',
|
||||||
|
@ -247,7 +235,7 @@ class TestManager(unittest.TestCase):
|
||||||
assert results['changed'] is True
|
assert results['changed'] is True
|
||||||
assert results['content'] == 'this is my content'
|
assert results['content'] == 'this is my content'
|
||||||
assert results['module'] == 'gtm'
|
assert results['module'] == 'gtm'
|
||||||
assert results['src'] == '/path/to/irules/foo.tcl'
|
assert results['src'] == '{0}/create_ltm_irule.tcl'.format(fixture_path)
|
||||||
assert len(results.keys()) == 4
|
assert len(results.keys()) == 4
|
||||||
|
|
||||||
def test_module_mutual_exclusion(self, *args):
|
def test_module_mutual_exclusion(self, *args):
|
||||||
|
|
Loading…
Reference in a new issue