Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/iosxr/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_command.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZddlmZddlmZmZddlmZd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�

---
module: iosxr_command
version_added: "2.1"
author: "Ricardo Carrillo Cruz (@rcarrillocruz)"
short_description: Run commands on remote devices running Cisco IOS XR
description:
  - Sends arbitrary commands to an IOS XR 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.
  - This module does not support running commands in configuration mode.
    Please use M(iosxr_config) to configure iosxr devices.
extends_documentation_fragment: iosxr
notes:
  - Make sure the user has been authorized to execute commands terminal length 0, terminal width 512 and terminal exec prompt no-timestamp.
  - This module works with C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html).
  - This module does not support C(netconf) connection.
  - Tested against IOS XR 6.1.3
options:
  commands:
    description:
      - List of commands to send to the remote iosxr 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.
    aliases: ['waitfor']
    version_added: "2.2"
  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']
    version_added: "2.2"
  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 show version on remote devices
    iosxr_command:
      commands: show version

  - name: run show version and check to see if output contains iosxr
    iosxr_command:
      commands: show version
      wait_for: result[0] contains IOS-XR

  - name: run multiple commands on remote nodes
    iosxr_command:
      commands:
        - show version
        - show interfaces
        - { command: example command that prompts, prompt: expected prompt, answer: yes}

  - name: run multiple commands and evaluate the output
    iosxr_command:
      commands:
        - show version
        - show interfaces
      wait_for:
        - result[0] contains IOS-XR
        - result[1] contains Loopback0
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(tto_text(t
AnsibleModule(tConditional(tto_lines(trun_commandstiosxr_argument_spec(tcommand_speccC`s�|jd}xvt|�D]h}y|d}Wntk
rG|}nX|jr|jd�r|jd|�|j|�qqW|S(NtcommandstcommandtshowsHOnly show commands are supported when using check mode, not executing %s(tparamstlistt	Exceptiont
check_modet
startswithtappendtremove(tmoduletwarningsRtitemR((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_command.pytparse_commands�s


cC`sjtdtdddt�dtddddg�dtd	d
dd
dg�d
td	ddd�dtd	ddd��}|jt�|jt�td|dt�}t�}itd6|d6}t||�}|j	dp�t�}y#g|D]}t
|�^q�}Wn)tk
r:}|jdt
|��nX|j	d
}	|j	d}
|j	d}x�|	dkr�t||�}xIt|�D];}
|
|�r�|dkr�t�}Pn|j|
�q�q�W|s�Pntj|
�|	d8}	qeW|r2g|D]}
|
j^q�}d}|jd|d|�n|ji|d6tt|��d6�|j|�dS(NRttypeRtrequiredtwait_fortaliasestwaitfortmatchtdefaulttalltchoicestanytretriesi
tinttintervalit
argument_spectsupports_check_modetchangedRtmsgis:One or more conditional statements have not been satisfiedtfailed_conditionststdouttstdout_lines(tdicttTruetupdateR
RR	RtFalseRRR
tAttributeErrort	fail_jsonRRRttimetsleeptrawRt	exit_json(R*RRtresultRRtctconditionalstexcR'R)R"t	responsesRR.R-((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_command.pytmain�sR

		#


	
	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR7tansible.module_utils._textRtansible.module_utils.basicR	t+ansible.module_utils.network.common.parsingR
t)ansible.module_utils.network.common.utilsRt(ansible.module_utils.network.iosxr.iosxrRR
RRR@t__name__(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_command.pyt<module>s$


A		<

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