|
|
@ -1,18 +1,16 @@
|
|
|
|
#!/usr/bin/python
|
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
# (c) 2013, Nandor Sivok <nandor@gawker.com>
|
|
|
|
# Copyright: (c) 2013, Nandor Sivok <nandor@gawker.com>
|
|
|
|
# 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
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
__metaclass__ = type
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
'status': ['deprecated'],
|
|
|
|
'status': ['deprecated'],
|
|
|
|
'supported_by': 'community'}
|
|
|
|
'supported_by': 'community'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
---
|
|
|
|
module: netscaler
|
|
|
|
module: netscaler
|
|
|
@ -24,85 +22,69 @@ deprecated: In 2.4 use M(netscaler_service) and M(netscaler_server) instead.
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
nsc_host:
|
|
|
|
nsc_host:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- hostname or ip of your netscaler
|
|
|
|
- Hostname or ip of your netscaler.
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
default: null
|
|
|
|
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
nsc_protocol:
|
|
|
|
nsc_protocol:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- protocol used to access netscaler
|
|
|
|
- Protocol used to access netscaler.
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: https
|
|
|
|
default: https
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
user:
|
|
|
|
user:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- username
|
|
|
|
- Username.
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
default: null
|
|
|
|
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
password:
|
|
|
|
password:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- password
|
|
|
|
- Password.
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
default: null
|
|
|
|
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
action:
|
|
|
|
action:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the action you want to perform on the entity
|
|
|
|
- The action you want to perform on the entity.
|
|
|
|
required: false
|
|
|
|
choices: [ disable, enable ]
|
|
|
|
default: disable
|
|
|
|
default: disable
|
|
|
|
choices: ["enable", "disable"]
|
|
|
|
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
name:
|
|
|
|
name:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- name of the entity
|
|
|
|
- Name of the entity.
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
default: hostname
|
|
|
|
default: hostname
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
type:
|
|
|
|
type:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- type of the entity
|
|
|
|
- Type of the entity.
|
|
|
|
required: false
|
|
|
|
choices: [ server, service ]
|
|
|
|
default: server
|
|
|
|
default: server
|
|
|
|
choices: ["server", "service"]
|
|
|
|
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
validate_certs:
|
|
|
|
validate_certs:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- If C(no), SSL certificates for the target url will not be validated. This should only be used
|
|
|
|
- If C(no), SSL certificates for the target url will not be validated.
|
|
|
|
on personally controlled sites using self-signed certificates.
|
|
|
|
- This should only be used on personally controlled sites using self-signed certificates.
|
|
|
|
required: false
|
|
|
|
type: bool
|
|
|
|
default: 'yes'
|
|
|
|
default: 'yes'
|
|
|
|
choices: ['yes', 'no']
|
|
|
|
author:
|
|
|
|
|
|
|
|
- Nandor Sivok (@dominis)
|
|
|
|
requirements: []
|
|
|
|
|
|
|
|
author: "Nandor Sivok (@dominis)"
|
|
|
|
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
|
# Disable the server
|
|
|
|
- name: Disable the server
|
|
|
|
- netscaler:
|
|
|
|
netscaler:
|
|
|
|
nsc_host: nsc.example.com
|
|
|
|
nsc_host: nsc.example.com
|
|
|
|
user: apiuser
|
|
|
|
user: apiuser
|
|
|
|
password: apipass
|
|
|
|
password: apipass
|
|
|
|
|
|
|
|
|
|
|
|
# Enable the server
|
|
|
|
- name: Enable the server
|
|
|
|
- netscaler:
|
|
|
|
netscaler:
|
|
|
|
nsc_host: nsc.example.com
|
|
|
|
nsc_host: nsc.example.com
|
|
|
|
user: apiuser
|
|
|
|
user: apiuser
|
|
|
|
password: apipass
|
|
|
|
password: apipass
|
|
|
|
action: enable
|
|
|
|
action: enable
|
|
|
|
|
|
|
|
|
|
|
|
# Disable the service local:8080
|
|
|
|
- name: Disable the service local:8080
|
|
|
|
- netscaler:
|
|
|
|
netscaler:
|
|
|
|
nsc_host: nsc.example.com
|
|
|
|
nsc_host: nsc.example.com
|
|
|
|
user: apiuser
|
|
|
|
user: apiuser
|
|
|
|
password: apipass
|
|
|
|
password: apipass
|
|
|
|
name: 'local:8080'
|
|
|
|
name: local:8080
|
|
|
|
type: service
|
|
|
|
type: service
|
|
|
|
action: disable
|
|
|
|
action: disable
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import base64
|
|
|
|
import base64
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
import socket
|
|
|
|
import socket
|
|
|
@ -174,15 +156,15 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec=dict(
|
|
|
|
argument_spec=dict(
|
|
|
|
nsc_host = dict(required=True),
|
|
|
|
nsc_host=dict(type='str', required=True),
|
|
|
|
nsc_protocol = dict(default='https'),
|
|
|
|
nsc_protocol=dict(type='str', default='https'),
|
|
|
|
user = dict(required=True),
|
|
|
|
user=dict(type='str', required=True),
|
|
|
|
password = dict(required=True, no_log=True),
|
|
|
|
password=dict(type='str', required=True, no_log=True),
|
|
|
|
action = dict(default='enable', choices=['enable','disable']),
|
|
|
|
action=dict(type='str', default='enable', choices=['disable', 'enable']),
|
|
|
|
name = dict(default=socket.gethostname()),
|
|
|
|
name=dict(type='str', default=socket.gethostname()),
|
|
|
|
type = dict(default='server', choices=['service', 'server']),
|
|
|
|
type=dict(type='str', default='server', choices=['server', 'service']),
|
|
|
|
validate_certs=dict(default='yes', type='bool'),
|
|
|
|
validate_certs=dict(type='bool', default=True),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
rc = 0
|
|
|
|
rc = 0
|
|
|
|