|
|
|
|
@ -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_config
|
|
|
|
|
short_description: Manage BIG-IP configuration sections.
|
|
|
|
|
short_description: Manage BIG-IP configuration sections
|
|
|
|
|
description:
|
|
|
|
|
- Manages a BIG-IP configuration by allowing TMSH commands that
|
|
|
|
|
modify running configuration, or merge SCF formatted files into
|
|
|
|
|
@ -69,48 +73,48 @@ author:
|
|
|
|
|
- Tim Rupp (@caphrim007)
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
|
EXAMPLES = r'''
|
|
|
|
|
- name: Save the running configuration of the BIG-IP
|
|
|
|
|
bigip_config:
|
|
|
|
|
save: yes
|
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
|
password: "secret"
|
|
|
|
|
user: "admin"
|
|
|
|
|
validate_certs: "no"
|
|
|
|
|
server: lb.mydomain.com
|
|
|
|
|
password: secret
|
|
|
|
|
user: admin
|
|
|
|
|
validate_certs: no
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
- name: Reset the BIG-IP configuration, for example, to RMA the device
|
|
|
|
|
bigip_config:
|
|
|
|
|
reset: yes
|
|
|
|
|
save: yes
|
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
|
password: "secret"
|
|
|
|
|
user: "admin"
|
|
|
|
|
validate_certs: "no"
|
|
|
|
|
server: lb.mydomain.com
|
|
|
|
|
password: secret
|
|
|
|
|
user: admin
|
|
|
|
|
validate_certs: no
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
- name: Load an SCF configuration
|
|
|
|
|
bigip_config:
|
|
|
|
|
merge_content: "{{ lookup('file', '/path/to/config.scf') }}"
|
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
|
password: "secret"
|
|
|
|
|
user: "admin"
|
|
|
|
|
validate_certs: "no"
|
|
|
|
|
server: lb.mydomain.com
|
|
|
|
|
password: secret
|
|
|
|
|
user: admin
|
|
|
|
|
validate_certs: no
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
|
RETURN = r'''
|
|
|
|
|
stdout:
|
|
|
|
|
description: The set of responses from the options
|
|
|
|
|
returned: always
|
|
|
|
|
type: list
|
|
|
|
|
sample: ['...', '...']
|
|
|
|
|
description: The set of responses from the options
|
|
|
|
|
returned: always
|
|
|
|
|
type: list
|
|
|
|
|
sample: ['...', '...']
|
|
|
|
|
|
|
|
|
|
stdout_lines:
|
|
|
|
|
description: The value of stdout split into a list
|
|
|
|
|
returned: always
|
|
|
|
|
type: list
|
|
|
|
|
sample: [['...', '...'], ['...'], ['...']]
|
|
|
|
|
description: The value of stdout split into a list
|
|
|
|
|
returned: always
|
|
|
|
|
type: list
|
|
|
|
|
sample: [['...', '...'], ['...'], ['...']]
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
@ -121,15 +125,17 @@ try:
|
|
|
|
|
except ImportError:
|
|
|
|
|
from io import StringIO
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.f5_utils import (
|
|
|
|
|
AnsibleF5Client,
|
|
|
|
|
AnsibleF5Parameters,
|
|
|
|
|
HAS_F5SDK,
|
|
|
|
|
F5ModuleError,
|
|
|
|
|
iControlUnexpectedHTTPError,
|
|
|
|
|
iteritems,
|
|
|
|
|
defaultdict
|
|
|
|
|
)
|
|
|
|
|
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.six import iteritems
|
|
|
|
|
from collections import defaultdict
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
|
|
|
|
except ImportError:
|
|
|
|
|
HAS_F5SDK = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Parameters(AnsibleF5Parameters):
|
|
|
|
|
|