diff --git a/lib/ansible/modules/network/f5/bigip_virtual_address.py b/lib/ansible/modules/network/f5/bigip_virtual_address.py index 3808ec6b0e0..96d462180f1 100644 --- a/lib/ansible/modules/network/f5/bigip_virtual_address.py +++ b/lib/ansible/modules/network/f5/bigip_virtual_address.py @@ -4,14 +4,18 @@ # 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 + + ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: bigip_virtual_address -short_description: Manage LTM virtual addresses on a BIG-IP. +short_description: Manage LTM virtual addresses on a BIG-IP description: - Manage LTM virtual addresses on a BIG-IP. version_added: "2.4" @@ -99,79 +103,88 @@ options: choices: - yes - no + partition: + description: + - Device partition to manage resources on. + required: False + default: 'Common' + version_added: 2.5 notes: - Requires the f5-sdk Python package on the host. This is as easy as pip install f5-sdk. - Requires the netaddr Python package on the host. This is as easy as pip install netaddr. extends_documentation_fragment: f5 +requirements: + - f5-sdk + - netaddr author: - Tim Rupp (@caphrim007) ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Add virtual address bigip_virtual_address: - server: "lb.mydomain.net" - user: "admin" - password: "secret" - state: "present" - partition: "Common" - address: "10.10.10.10" + server: lb.mydomain.net + user: admin + password: secret + state: present + partition: Common + address: 10.10.10.10 delegate_to: localhost - name: Enable route advertisement on the virtual address bigip_virtual_address: - server: "lb.mydomain.net" - user: "admin" - password: "secret" - state: "present" - address: "10.10.10.10" - use_route_advertisement: yes + server: lb.mydomain.net + user: admin + password: secret + state: present + address: 10.10.10.10 + use_route_advertisement: yes delegate_to: localhost ''' -RETURN = ''' +RETURN = r''' use_route_advertisement: - description: The new setting for whether to use route advertising or not. - returned: changed - type: bool - sample: true + description: The new setting for whether to use route advertising or not. + returned: changed + type: bool + sample: true auto_delete: - description: New setting for auto deleting virtual address. - returned: changed - type: string - sample: enabled + description: New setting for auto deleting virtual address. + returned: changed + type: string + sample: enabled icmp_echo: - description: New ICMP echo setting applied to virtual address. - returned: changed - type: string - sample: disabled + description: New ICMP echo setting applied to virtual address. + returned: changed + type: string + sample: disabled connection_limit: - description: The new connection limit of the virtual address. - returned: changed - type: int - sample: 1000 + description: The new connection limit of the virtual address. + returned: changed + type: int + sample: 1000 netmask: - description: The netmask of the virtual address. - returned: created - type: int - sample: 2345 + description: The netmask of the virtual address. + returned: created + type: int + sample: 2345 arp_state: - description: The new way the virtual address handles ARP requests. - returned: changed - type: string - sample: disabled + description: The new way the virtual address handles ARP requests. + returned: changed + type: string + sample: disabled address: - description: The address of the virtual address. - returned: created - type: int - sample: 2345 + description: The address of the virtual address. + returned: created + type: int + sample: 2345 state: - description: The new state of the virtual address. - returned: changed - type: string - sample: disabled + description: The new state of the virtual address. + returned: changed + type: string + sample: disabled ''' try: @@ -180,14 +193,17 @@ try: except ImportError: HAS_NETADDR = False -from ansible.module_utils.f5_utils import ( - AnsibleF5Client, - AnsibleF5Parameters, - HAS_F5SDK, - F5ModuleError, - iControlUnexpectedHTTPError -) -from ansible.module_utils.parsing.convert_bool import BOOLEANS_FALSE, BOOLEANS_TRUE +from ansible.module_utils.f5_utils import AnsibleF5Client +from ansible.module_utils.f5_utils import AnsibleF5Parameters +from ansible.module_utils.f5_utils import HAS_F5SDK +from ansible.module_utils.f5_utils import F5ModuleError +from ansible.module_utils.parsing.convert_bool import BOOLEANS_TRUE +from ansible.module_utils.parsing.convert_bool import BOOLEANS_FALSE + +try: + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError +except ImportError: + HAS_F5SDK = False class Parameters(AnsibleF5Parameters): diff --git a/test/sanity/import/skip.txt b/test/sanity/import/skip.txt index d9620bd0cb1..bf14a8478e9 100644 --- a/test/sanity/import/skip.txt +++ b/test/sanity/import/skip.txt @@ -25,7 +25,6 @@ lib/ansible/modules/network/f5/bigip_snmp.py lib/ansible/modules/network/f5/bigip_snmp_trap.py lib/ansible/modules/network/f5/bigip_ucs.py lib/ansible/modules/network/f5/bigip_user.py -lib/ansible/modules/network/f5/bigip_virtual_address.py lib/ansible/modules/network/ios/ios_static_route.py lib/ansible/modules/network/lenovo/cnos_backup.py lib/ansible/modules/network/lenovo/cnos_bgp.py diff --git a/test/units/modules/network/f5/test_bigip_virtual_address.py b/test/units/modules/network/f5/test_bigip_virtual_address.py index 13ce655642a..eb75a7fb26b 100644 --- a/test/units/modules/network/f5/test_bigip_virtual_address.py +++ b/test/units/modules/network/f5/test_bigip_virtual_address.py @@ -1,21 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright 2017 F5 Networks Inc. -# -# 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 License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# 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 @@ -38,11 +24,13 @@ try: from library.bigip_virtual_address import Parameters from library.bigip_virtual_address import ModuleManager from library.bigip_virtual_address import ArgumentSpec + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: try: from ansible.modules.network.f5.bigip_virtual_address import Parameters from ansible.modules.network.f5.bigip_virtual_address import ModuleManager from ansible.modules.network.f5.bigip_virtual_address import ArgumentSpec + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: raise SkipTest("F5 Ansible modules require the f5-sdk Python library")