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