|
|
@ -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_ucs
|
|
|
|
module: bigip_ucs
|
|
|
|
short_description: Manage upload, installation and removal of UCS files.
|
|
|
|
short_description: Manage upload, installation and removal of UCS files
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Manage upload, installation and removal of UCS files.
|
|
|
|
- Manage upload, installation and removal of UCS files.
|
|
|
|
version_added: "2.4"
|
|
|
|
version_added: "2.4"
|
|
|
@ -112,84 +116,91 @@ author:
|
|
|
|
- Tim Rupp (@caphrim007)
|
|
|
|
- Tim Rupp (@caphrim007)
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = r'''
|
|
|
|
- name: Upload UCS
|
|
|
|
- name: Upload UCS
|
|
|
|
bigip_ucs:
|
|
|
|
bigip_ucs:
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
server: lb.mydomain.com
|
|
|
|
user: "admin"
|
|
|
|
user: admin
|
|
|
|
password: "secret"
|
|
|
|
password: secret
|
|
|
|
ucs: "/root/bigip.localhost.localdomain.ucs"
|
|
|
|
ucs: /root/bigip.localhost.localdomain.ucs
|
|
|
|
state: "present"
|
|
|
|
state: present
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
- name: Install (upload, install) UCS.
|
|
|
|
- name: Install (upload, install) UCS.
|
|
|
|
bigip_ucs:
|
|
|
|
bigip_ucs:
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
server: lb.mydomain.com
|
|
|
|
user: "admin"
|
|
|
|
user: admin
|
|
|
|
password: "secret"
|
|
|
|
password: secret
|
|
|
|
ucs: "/root/bigip.localhost.localdomain.ucs"
|
|
|
|
ucs: /root/bigip.localhost.localdomain.ucs
|
|
|
|
state: "installed"
|
|
|
|
state: installed
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
- name: Install (upload, install) UCS without installing the license portion
|
|
|
|
- name: Install (upload, install) UCS without installing the license portion
|
|
|
|
bigip_ucs:
|
|
|
|
bigip_ucs:
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
server: lb.mydomain.com
|
|
|
|
user: "admin"
|
|
|
|
user: admin
|
|
|
|
password: "secret"
|
|
|
|
password: secret
|
|
|
|
ucs: "/root/bigip.localhost.localdomain.ucs"
|
|
|
|
ucs: /root/bigip.localhost.localdomain.ucs
|
|
|
|
state: "installed"
|
|
|
|
state: installed
|
|
|
|
no_license: "yes"
|
|
|
|
no_license: yes
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
- name: Install (upload, install) UCS except the license, and bypassing the platform check
|
|
|
|
- name: Install (upload, install) UCS except the license, and bypassing the platform check
|
|
|
|
bigip_ucs:
|
|
|
|
bigip_ucs:
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
server: lb.mydomain.com
|
|
|
|
user: "admin"
|
|
|
|
user: admin
|
|
|
|
password: "secret"
|
|
|
|
password: secret
|
|
|
|
ucs: "/root/bigip.localhost.localdomain.ucs"
|
|
|
|
ucs: /root/bigip.localhost.localdomain.ucs
|
|
|
|
state: "installed"
|
|
|
|
state: installed
|
|
|
|
no_license: "yes"
|
|
|
|
no_license: yes
|
|
|
|
no_platform_check: "yes"
|
|
|
|
no_platform_check: yes
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
- name: Install (upload, install) UCS using a passphrase necessary to load the UCS
|
|
|
|
- name: Install (upload, install) UCS using a passphrase necessary to load the UCS
|
|
|
|
bigip_ucs:
|
|
|
|
bigip_ucs:
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
server: lb.mydomain.com
|
|
|
|
user: "admin"
|
|
|
|
user: admin
|
|
|
|
password: "secret"
|
|
|
|
password: secret
|
|
|
|
ucs: "/root/bigip.localhost.localdomain.ucs"
|
|
|
|
ucs: /root/bigip.localhost.localdomain.ucs
|
|
|
|
state: "installed"
|
|
|
|
state: installed
|
|
|
|
passphrase: "MyPassphrase1234"
|
|
|
|
passphrase: MyPassphrase1234
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
- name: Remove uploaded UCS file
|
|
|
|
- name: Remove uploaded UCS file
|
|
|
|
bigip_ucs:
|
|
|
|
bigip_ucs:
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
server: lb.mydomain.com
|
|
|
|
user: "admin"
|
|
|
|
user: admin
|
|
|
|
password: "secret"
|
|
|
|
password: secret
|
|
|
|
ucs: "bigip.localhost.localdomain.ucs"
|
|
|
|
ucs: bigip.localhost.localdomain.ucs
|
|
|
|
state: "absent"
|
|
|
|
state: absent
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
RETURN = r'''
|
|
|
|
# only common fields returned
|
|
|
|
# only common fields returned
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
from collections import OrderedDict
|
|
|
|
|
|
|
|
from distutils.version import LooseVersion
|
|
|
|
from distutils.version import LooseVersion
|
|
|
|
from ansible.module_utils.f5_utils import (
|
|
|
|
from ansible.module_utils.f5_utils import AnsibleF5Client
|
|
|
|
AnsibleF5Client,
|
|
|
|
from ansible.module_utils.f5_utils import AnsibleF5Parameters
|
|
|
|
AnsibleF5Parameters,
|
|
|
|
from ansible.module_utils.f5_utils import HAS_F5SDK
|
|
|
|
HAS_F5SDK,
|
|
|
|
from ansible.module_utils.f5_utils import F5ModuleError
|
|
|
|
F5ModuleError,
|
|
|
|
from ansible.module_utils.six import iteritems
|
|
|
|
iControlUnexpectedHTTPError,
|
|
|
|
|
|
|
|
iteritems
|
|
|
|
try:
|
|
|
|
)
|
|
|
|
from collections import OrderedDict
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
|
|
|
|
HAS_F5SDK = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Parameters(AnsibleF5Parameters):
|
|
|
|
class Parameters(AnsibleF5Parameters):
|
|
|
@ -250,7 +261,6 @@ class Parameters(AnsibleF5Parameters):
|
|
|
|
cmd = 'tmsh load sys ucs /var/local/ucs/{0}'.format(self.basename)
|
|
|
|
cmd = 'tmsh load sys ucs /var/local/ucs/{0}'.format(self.basename)
|
|
|
|
# Append any options that might be specified
|
|
|
|
# Append any options that might be specified
|
|
|
|
options = OrderedDict(sorted(self.options.items(), key=lambda t: t[0]))
|
|
|
|
options = OrderedDict(sorted(self.options.items(), key=lambda t: t[0]))
|
|
|
|
print(options)
|
|
|
|
|
|
|
|
for k, v in iteritems(options):
|
|
|
|
for k, v in iteritems(options):
|
|
|
|
if v is False or v is None:
|
|
|
|
if v is False or v is None:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
@ -578,6 +588,9 @@ def main():
|
|
|
|
if not HAS_F5SDK:
|
|
|
|
if not HAS_F5SDK:
|
|
|
|
raise F5ModuleError("The python f5-sdk module is required")
|
|
|
|
raise F5ModuleError("The python f5-sdk module is required")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if sys.version_info < (2, 7):
|
|
|
|
|
|
|
|
raise F5ModuleError("F5 Ansible modules require Python >= 2.7")
|
|
|
|
|
|
|
|
|
|
|
|
spec = ArgumentSpec()
|
|
|
|
spec = ArgumentSpec()
|
|
|
|
|
|
|
|
|
|
|
|
client = AnsibleF5Client(
|
|
|
|
client = AnsibleF5Client(
|
|
|
|