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