�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
m Z d d
l m Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys)
---
module: pn_admin_syslog
author: "Pluribus Networks (@rajaspachipulusu17)"
version_added: "2.8"
short_description: CLI command to create/modify/delete admin-syslog
description:
- This module can be used to create the scope and other parameters of syslog event collection.
- This module can be used to modify parameters of syslog event collection.
- This module can be used to delete the scope and other parameters of syslog event collection.
options:
pn_cliswitch:
description:
- Target switch to run the CLI on.
required: False
type: str
state:
description:
- State the action to perform. Use C(present) to create admin-syslog and
C(absent) to delete admin-syslog C(update) to modify the admin-syslog.
required: True
type: str
choices: ['present', 'absent', 'update']
pn_scope:
description:
- Scope of the system log.
required: False
type: str
choices: ['local', 'fabric']
pn_host:
description:
- Hostname to log system events.
required: False
type: str
pn_port:
description:
- Host port.
required: False
type: str
pn_transport:
description:
- Transport for log events - tcp/tls or udp.
required: False
type: str
choices: ['tcp-tls', 'udp']
default: 'udp'
pn_message_format:
description:
- message-format for log events - structured or legacy.
required: False
choices: ['structured', 'legacy']
type: str
pn_name:
description:
- name of the system log.
required: False
type: str
s�
- name: admin-syslog functionality
pn_admin_syslog:
pn_cliswitch: "sw01"
state: "absent"
pn_name: "foo"
pn_scope: "local"
- name: admin-syslog functionality
pn_admin_syslog:
pn_cliswitch: "sw01"
state: "present"
pn_name: "foo"
pn_scope: "local"
pn_host: "166.68.224.46"
pn_message_format: "structured"
- name: admin-syslog functionality
pn_admin_syslog:
pn_cliswitch: "sw01"
state: "update"
pn_name: "foo"
pn_host: "166.68.224.10"
s�
command:
description: the CLI command run on the target node.
returned: always
type: str
stdout:
description: set of responses from the admin-syslog command.
returned: always
type: list
stderr:
description: set of error responses from the admin-syslog command.
returned: on error
type: list
changed:
description: indicates whether the CLI caused changes on the target.
returned: always
type: bool
( t
AnsibleModule( t pn_clit run_cli( t run_commandsc C` sJ | j d } | d 7} t | | � d } | j � } | | k rF t St S( s�
This method checks for idempotency using the admin-syslog-show command.
If a user with given name exists, return as True else False.
:param module: The Ansible module to fetch input parameters
:param cli: The CLI string
t pn_names. admin-syslog-show format name no-show-headersi ( t paramsR t splitt Truet False( t modulet clit namet out( ( sT /usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_admin_syslog.pyt check_cliz s
c
C` sM t d d d d d d � } t d t d t d t d
d � d t d t d
d d
| j � � d t d t d
d d
d d g � d t d t d
d � d t d t d
d � d t d t d
d d
d d g d d � d t d t d
d d
d d g � d t d t d
d � � d d d d d d g g d d d g g d d d g g f d d d d d d g g � } | j d } | j d } | j d } | j d } | j d } | j d } | j d } | j d } | | }
t | | � } t | | � } | d |
| f 7} |
d k r8| t k r8| j d t d d | � q8n |
d k rp| t k rp| j d! t d d | � qpn |
d k r�| t k r�| j d! t d d"