|
|
|
@ -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_iapp_template
|
|
|
|
|
short_description: Manages TCL iApp templates on a BIG-IP.
|
|
|
|
|
short_description: Manages TCL iApp templates on a BIG-IP
|
|
|
|
|
description:
|
|
|
|
|
- Manages TCL iApp templates on a BIG-IP. This module will allow you to
|
|
|
|
|
deploy iApp templates to the BIG-IP and manage their lifecycle. The
|
|
|
|
@ -52,7 +56,7 @@ options:
|
|
|
|
|
be provided when creating new templates.
|
|
|
|
|
state:
|
|
|
|
|
description:
|
|
|
|
|
- Whether the iRule should exist or not.
|
|
|
|
|
- Whether the iApp template should exist or not.
|
|
|
|
|
default: present
|
|
|
|
|
choices:
|
|
|
|
|
- present
|
|
|
|
@ -60,8 +64,7 @@ options:
|
|
|
|
|
partition:
|
|
|
|
|
description:
|
|
|
|
|
- Device partition to manage resources on.
|
|
|
|
|
required: False
|
|
|
|
|
default: 'Common'
|
|
|
|
|
default: Common
|
|
|
|
|
notes:
|
|
|
|
|
- Requires the f5-sdk Python package on the host. This is as easy as pip
|
|
|
|
|
install f5-sdk.
|
|
|
|
@ -70,55 +73,55 @@ author:
|
|
|
|
|
- Tim Rupp (@caphrim007)
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
|
EXAMPLES = r'''
|
|
|
|
|
- name: Add the iApp contained in template iapp.tmpl
|
|
|
|
|
bigip_iapp_template:
|
|
|
|
|
content: "{{ lookup('template', 'iapp.tmpl') }}"
|
|
|
|
|
password: "secret"
|
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
|
state: "present"
|
|
|
|
|
user: "admin"
|
|
|
|
|
content: "{{ lookup('template', 'iapp.tmpl') }}"
|
|
|
|
|
password: secret
|
|
|
|
|
server: lb.mydomain.com
|
|
|
|
|
state: present
|
|
|
|
|
user: admin
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
- name: Update a template in place
|
|
|
|
|
bigip_iapp_template:
|
|
|
|
|
content: "{{ lookup('template', 'iapp-new.tmpl') }}"
|
|
|
|
|
password: "secret"
|
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
|
state: "present"
|
|
|
|
|
user: "admin"
|
|
|
|
|
content: "{{ lookup('template', 'iapp-new.tmpl') }}"
|
|
|
|
|
password: secret
|
|
|
|
|
server: lb.mydomain.com
|
|
|
|
|
state: present
|
|
|
|
|
user: admin
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
- name: Update a template in place that has existing services created from it.
|
|
|
|
|
bigip_iapp_template:
|
|
|
|
|
content: "{{ lookup('template', 'iapp-new.tmpl') }}"
|
|
|
|
|
force: yes
|
|
|
|
|
password: "secret"
|
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
|
state: "present"
|
|
|
|
|
user: "admin"
|
|
|
|
|
content: "{{ lookup('template', 'iapp-new.tmpl') }}"
|
|
|
|
|
force: yes
|
|
|
|
|
password: secret
|
|
|
|
|
server: lb.mydomain.com
|
|
|
|
|
state: present
|
|
|
|
|
user: admin
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
|
RETURN = r'''
|
|
|
|
|
# only common fields returned
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import uuid
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.f5_utils import (
|
|
|
|
|
AnsibleF5Client,
|
|
|
|
|
AnsibleF5Parameters,
|
|
|
|
|
HAS_F5SDK,
|
|
|
|
|
F5ModuleError,
|
|
|
|
|
iteritems,
|
|
|
|
|
defaultdict,
|
|
|
|
|
iControlUnexpectedHTTPError
|
|
|
|
|
)
|
|
|
|
|
from f5.utils.iapp_parser import (
|
|
|
|
|
NonextantTemplateNameException
|
|
|
|
|
)
|
|
|
|
|
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
|
|
|
|
|
from f5.utils.iapp_parser import NonextantTemplateNameException
|
|
|
|
|
except ImportError:
|
|
|
|
|
HAS_F5SDK = False
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
from StringIO import StringIO
|
|
|
|
|