Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZddlmZmZddlmZd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys=	
module: edgeos_command
version_added: "2.5"
author:
  - Chad Norgan (@beardymcbeards)
  - Sam Doran (@samdoran)
short_description: Run one or more commands on EdgeOS devices
description:
  - This command module allows running one or more commands on a remote
    device running EdgeOS, such as the Ubiquiti EdgeRouter.
  - This module does not support running commands in configuration mode.
  - Certain C(show) commands in EdgeOS produce many lines of output and
    use a custom pager that can cause this module to hang.  If the
    value of the environment variable C(ANSIBLE_EDGEOS_TERMINAL_LENGTH)
    is not set, the default number of 10000 is used.
  - "This is a network module and requires C(connection: network_cli)
    in order to work properly."
  - For more information please see the L(Network Guide,../network/getting_started/index.html).
options:
  commands:
    description:
      - The commands or ordered set of commands that should be run against the
        remote device. The output of the command is returned to the playbook.
        If the C(wait_for) argument is provided, the module is not returned
        until the condition is met or the number of retries is exceeded.
    required: True
  wait_for:
    description:
      - Causes the task to wait for a specific condition to be met before
        moving forward. If the condition is not met before the specified
        number of retries is exceeded, the task will fail.
    required: False
  match:
    description:
      - Used in conjunction with C(wait_for) to create match policy. If set to
        C(all), then all conditions in C(wait_for) must be met. If set to
        C(any), then only one condition must match.
    required: False
    default: 'all'
    choices: ['any', 'all']
  retries:
    description:
      - Number of times a command should be tried before it is considered failed.
        The command is run on the target device and evaluated against the
        C(wait_for) conditionals.
    required: False
    default: 10
  interval:
    description:
      - The number of seconds to wait between C(retries) of the command.
    required: False
    default: 1

notes:
  - Tested against EdgeOS 1.9.7
  - Running C(show system boot-messages all) will cause the module to hang since
    EdgeOS is using a custom pager setting to display the output of that command.
s�
tasks:
  - name: Reboot the device
    edgeos_command:
      commands: reboot now

  - name: Show the configuration for eth0 and eth1
    edgeos_command:
      commands: show interfaces ethernet {{ item }}
    loop:
      - eth0
      - eth1
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
  type: list
  sample: [['...', '...'], ['...'], ['...']]
N(tto_text(t
AnsibleModule(tConditional(ttransform_commandstto_lines(trun_commandscC`skt|�}|jrgxOt|�D]>}|djd�s"|jd|d�|j|�q"q"Wn|S(NtcommandtshowsHOnly show commands are supported when using check mode, not executing %s(Rt
check_modetlistt
startswithtappendtremove(tmoduletwarningstcommandstitem((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_command.pytparse_commandsks	cC`sGtdtdddt�dtdd�dtddd	dd
g�dtdddd
�dtdddd
��}td|dt�}t�}itd6|d6}t||�}|jdp�t�}y#g|D]}t|�^q�}Wn)tk
r}|j	dt
|��nX|jd}	|jd}
|jd}x�|	dkr�t||�}xIt|�D];}
|
|�rj|d
kr�t�}Pn|j|
�qjqjW|s�Pnt
j|
�|	d8}	qBW|rg|D]}
|
j^q�}d}|j	d|d|�n|ji|d6tt|��d6�|j|�dS(NRttypeRtrequiredtwait_fortmatchtdefaulttalltchoicestanytretriesi
tinttintervalit
argument_spectsupports_check_modetchangedRtmsgis:One or more conditional statements have not been satisfiedtfailed_conditionststdouttstdout_lines(tdicttTrueR	RtFalseRtparamsR
tAttributeErrort	fail_jsonRR
RttimetsleeptrawtupdateRt	exit_json(tspecRRtresultRRtctconditionalstexcR"R$Rt	responsesRR)R(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_command.pytmainzsL	#


	
	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR2tansible.module_utils._textRtansible.module_utils.basicR	t+ansible.module_utils.network.common.parsingR
t)ansible.module_utils.network.common.utilsRRt*ansible.module_utils.network.edgeos.edgeosR
RR=t__name__(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_command.pyt<module>s"


;
		6

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