Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/routeros/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_command.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZddlmZddlmZddlmZddlmZd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys&
---
module: routeros_command
version_added: "2.7"
author: "Egor Zaitsev (@heuels)"
short_description: Run commands on remote devices running MikroTik RouterOS
description:
  - Sends arbitrary commands to an RouterOS node and returns the results
    read from the device. This module includes an
    argument that will cause the module to wait for a specific condition
    before returning or timing out if the condition is not met.
options:
  commands:
    description:
      - List of commands to send to the remote RouterOS device over the
        configured provider. The resulting output from the command
        is returned. If the I(wait_for) argument is provided, the
        module is not returned until the condition is satisfied or
        the number of retries has expired.
    required: true
  wait_for:
    description:
      - List of conditions to evaluate against the output of the
        command. The task will wait for each condition to be true
        before moving forward. If the conditional is not true
        within the configured number of retries, the task fails.
        See examples.
  match:
    description:
      - The I(match) argument is used in conjunction with the
        I(wait_for) argument to specify the match policy.  Valid
        values are C(all) or C(any).  If the value is set to C(all)
        then all conditionals in the wait_for must be satisfied.  If
        the value is set to C(any) then only one of the values must be
        satisfied.
    default: all
    choices: ['any', 'all']
  retries:
    description:
      - Specifies the number of retries a command should by tried
        before it is considered failed. The command is run on the
        target device every retry and evaluated against the
        I(wait_for) conditions.
    default: 10
  interval:
    description:
      - Configures the interval in seconds to wait between retries
        of the command. If the command does not pass the specified
        conditions, the interval indicates how long to wait before
        trying the command again.
    default: 1
s�
tasks:
  - name: run command on remote devices
    routeros_command:
      commands: /system routerboard print

  - name: run command and check to see if output contains routeros
    routeros_command:
      commands: /system resource print
      wait_for: result[0] contains MikroTik

  - name: run multiple commands on remote nodes
    routeros_command:
      commands:
        - /system routerboard print
        - /system identity print

  - name: run multiple commands and evaluate the output
    routeros_command:
      commands:
        - /system routerboard print
        - /interface ethernet print
      wait_for:
        - result[0] contains x86
        - result[1] contains ether1
s�
stdout:
  description: The set of responses from the commands
  returned: always apart from low level errors (such as action plugin)
  type: list
  sample: ['...', '...']
stdout_lines:
  description: The value of stdout split into a list
  returned: always apart from low level errors (such as action plugin)
  type: list
  sample: [['...', '...'], ['...'], ['...']]
failed_conditions:
  description: The list of conditionals that have failed
  returned: failed
  type: list
  sample: ['...', '...']
N(trun_commands(trouteros_argument_spec(t
AnsibleModule(tComplexList(tConditional(tstring_typescc`sAx:|D]2}t|t�r4t|�jd�}n|VqWdS(Ns
(t
isinstanceR
tstrtsplit(tstdouttitem((sU/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_command.pytto_lineszs
c
C`stdtdddt�dtdd�dtddd	dd
g�dtdddd
�dtdddd
��}|jt�td|dt�}itd6}|jdp�t�}g|D]}t|�^q�}|jd}|jd}|jd}x�|dkr�t	||jd�}	xIt|�D];}
|
|	�r/|d
krZt�}Pn|j
|
�q/q/W|sxPntj|�|d8}qW|r�g|D]}
|
j
^q�}d}|jd|d|�n|jitd6|	d6tt|	��d6�|j|�dS(s*main entry point for module execution
    tcommandsttypetlisttrequiredtwait_fortmatchtdefaulttalltchoicestanytretriesi
tinttintervalit
argument_spectsupports_check_modetchangedis:One or more conditional statements have not been satisfiedtmsgtfailed_conditionsRtstdout_linesN(tdicttTruetupdateR	R
tFalsetparamsRRRtremovettimetsleeptrawt	fail_jsonRt	exit_json(
R!tmoduletresultRtctconditionalsRR Rt	responsesRR%R$((sU/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_command.pytmain�sH
	



	
	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtreR-t.ansible.module_utils.network.routeros.routerosRR	tansible.module_utils.basicR
t)ansible.module_utils.network.common.utilsRt+ansible.module_utils.network.common.parsingRtansible.module_utils.sixR
RR7t__name__(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_command.pyt<module>s&


6		9

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]