�
�Udac @ s i d d 6d g d 6d d 6Z d Z d Z d Z d d
l Z d d l m Z d d l m Z m Z d d
l m
Z
d d l m Z d d l m
Z
d d l m Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z e d k re � n d
S( s 1.1t metadata_versiont previewt statust networkt supported_bys]
---
module: nxos_nxapi
extends_documentation_fragment: nxos
version_added: "2.1"
author: "Peter Sprygada (@privateip)"
short_description: Manage NXAPI configuration on an NXOS device.
description:
- Configures the NXAPI feature on devices running Cisco NXOS. The
NXAPI feature is absent from the configuration by default. Since
this module manages the NXAPI feature it only supports the use
of the C(Cli) transport.
options:
http_port:
description:
- Configure the port with which the HTTP server will listen on
for requests. By default, NXAPI will bind the HTTP service
to the standard HTTP port 80. This argument accepts valid
port values in the range of 1 to 65535.
required: false
default: 80
http:
description:
- Controls the operating state of the HTTP protocol as one of the
underlying transports for NXAPI. By default, NXAPI will enable
the HTTP transport when the feature is first configured. To
disable the use of the HTTP transport, set the value of this
argument to False.
required: false
default: yes
type: bool
aliases: ['enable_http']
https_port:
description:
- Configure the port with which the HTTPS server will listen on
for requests. By default, NXAPI will bind the HTTPS service
to the standard HTTPS port 443. This argument accepts valid
port values in the range of 1 to 65535.
required: false
default: 443
https:
description:
- Controls the operating state of the HTTPS protocol as one of the
underlying transports for NXAPI. By default, NXAPI will disable
the HTTPS transport when the feature is first configured. To
enable the use of the HTTPS transport, set the value of this
argument to True.
required: false
default: no
type: bool
aliases: ['enable_https']
sandbox:
description:
- The NXAPI feature provides a web base UI for developers for
entering commands. This feature is initially disabled when
the NXAPI feature is configured for the first time. When the
C(sandbox) argument is set to True, the developer sandbox URL
will accept requests and when the value is set to False, the
sandbox URL is unavailable. This is supported on NX-OS 7K series.
required: false
default: no
type: bool
aliases: ['enable_sandbox']
state:
description:
- The C(state) argument controls whether or not the NXAPI
feature is configured on the remote device. When the value
is C(present) the NXAPI feature configuration is present in
the device running-config. When the values is C(absent) the
feature configuration is removed from the running-config.
choices: ['present', 'absent']
required: false
default: present
ssl_strong_ciphers:
description:
- Controls the use of whether strong or weak ciphers are configured.
By default, this feature is disabled and weak ciphers are
configured. To enable the use of strong ciphers, set the value of
this argument to True.
required: false
default: no
type: bool
version_added: "2.7"
tlsv1_0:
description:
- Controls the use of the Transport Layer Security version 1.0 is
configured. By default, this feature is enabled. To disable the
use of TLSV1.0, set the value of this argument to True.
required: false
default: yes
type: bool
version_added: "2.7"
tlsv1_1:
description:
- Controls the use of the Transport Layer Security version 1.1 is
configured. By default, this feature is disabled. To enable the
use of TLSV1.1, set the value of this argument to True.
required: false
default: no
type: bool
version_added: "2.7"
tlsv1_2:
description:
- Controls the use of the Transport Layer Security version 1.2 is
configured. By default, this feature is disabled. To enable the
use of TLSV1.2, set the value of this argument to True.
required: false
default: no
type: bool
version_added: "2.7"
sI
- name: Enable NXAPI access with default configuration
nxos_nxapi:
state: present
- name: Enable NXAPI with no HTTP, HTTPS at port 9443 and sandbox disabled
nxos_nxapi:
enable_http: false
https_port: 9443
https: yes
enable_sandbox: no
- name: remove NXAPI configuration
nxos_nxapi:
state: absent
s�
updates:
description:
- Returns the list of commands that need to be pushed into the remote
device to satisfy the arguments
returned: always
type: list
sample: ['no feature nxapi']
i����N( t LooseVersion( t run_commandst load_config( t nxos_argument_spec( t get_capabilities( t
AnsibleModule( t iteritemsc C s5 | j d d � } | d k r1 | j d d � n | d d } d | k rk | j d rk | j d d � n | j d
} | d k r� d | j d
<| j d
� n) | d k r� d | j d
<| j d � n xd d d g D]V } | j | d k r� d | j | k od k n s-| j d d | � q-q� q� W| S( Nt network_apit nxapit msgs) module not supported over nxapi transportt device_infot network_os_platformt 7Kt sandboxsE sandbox or enable_sandbox is supported on NX-OS 7K series of switchest statet startedt presentsh state=started is deprecated and will be removed in a a future release. Please use state=present insteadt stoppedt absentsg state=stopped is deprecated and will be removed in a a future release. Please use state=absent insteadt http_portt
https_porti i�� s %s must be between 1 and 65535( t gett fail_jsont paramst appendt None( t modulet warningst capabilitiesR t os_platformR t key( ( sK /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_nxapi.pyt
check_args� s$
#c s. t � } t � } d } d } | j d � } | rz | j d � } | rU | d } n | j d � } | rz | d } qz n � � f d � }
|
d � r� � d d k r� d g S| j d � n � d d k r� | Sx� d
d g D]� } | d } |
| � rB� j | � t k r"d
| | | <qBd | � j | � f | | <n |
| � r� � j | � t k r� d | � j | � f | | <q� q� W|
d � r�d | d <� d s�d | d | d <q�n | r
| r
| d k s�| d k rt | � d k r|
d � r+d | d <� d t k r+d | d <q+n d }
d } x� i d d 6d d 6d d 6j � D]u \ } } |
| � r�� j | � t k r�d j | | g � } q�qY� j | � t k rYd j |
| g � }
qYqYWt
| � d k rd! d j | |
g � | d"