Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
lmZmZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatustnetworktsupported_bysb
---
module: cli_command
version_added: "2.7"
author: "Nathaniel Case (@Qalthos)"
short_description: Run a cli command on cli-based network devices
description:
  - Sends a command to a network device and returns the result read from the device.
extends_documentation_fragment: network_agnostic
options:
  command:
    description:
      - The command to send to the remote network device.  The resulting output
        from the command is returned, unless I(sendonly) is set.
    required: true
  prompt:
    description:
      - A single regex pattern or a sequence of patterns to evaluate the expected
        prompt from I(command).
    required: false
    type: list
  answer:
    description:
      - The answer to reply with if I(prompt) is matched. The value can be a single answer
        or a list of answer for multiple prompts. In case the command execution results in
        multiple prompts the sequence of the prompt and excepted answer should be in same order.
    required: false
    type: list
  sendonly:
    description:
      - The boolean value, that when set to true will send I(command) to the
        device but not wait for a result.
    type: bool
    default: false
    required: false
  newline:
    description:
      - The boolean value, that when set to false will send I(answer) to the
        device without a trailing newline.
    type: bool
    default: true
    required: false
    version_added: 2.9
  check_all:
    description:
      - By default if any one of the prompts mentioned in C(prompt) option is matched it won't check
        for other prompts. This boolean flag, that when set to I(True) will check for all the prompts
        mentioned in C(prompt) option in the given order. If the option is set to I(True) all the prompts
        should be received from remote host if not it will result in timeout.
    type: bool
    default: false
sm
- name: run show version on remote devices
  cli_command:
    command: show version

- name: run command with json formatted output
  cli_command:
    command: show version | json

- name: run command expecting user confirmation
  cli_command:
    command: commit replace
    prompt: This commit will replace or remove the entire running configuration
    answer: yes

- name: run command expecting user confirmation
  cli_command:
    command: show interface summary
    prompt: Press any key to continue
    answer: y
    newline: false

- name: run config mode command and handle prompt/answer
  cli_command:
    command: "{{ item }}"
    prompt:
      - "Exit with uncommitted changes"
    answer: 'y'
  loop:
    - configure
    - set system syslog file test any any
    - exit

- name: multiple prompt, multiple answer (mandatory check for all prompts)
  cli_command:
    command: "copy sftp sftp://user@host//user/test.img"
    check_all: True
    prompt:
      - "Confirm download operation"
      - "Password"
      - "Do you want to change that to the standby image"
    answer:
      - 'y'
      - <password>
      - 'y'
s�
stdout:
  description: The response from the command
  returned: when sendonly is false
  type: str
  sample: 'Version:      VyOS 1.1.7[...]'

json:
  description: A dictionary representing a JSON-formatted response
  returned: when the device response is valid JSON
  type: dict
  sample: |
    {
      "architecture": "i386",
      "bootupTimestamp": 1532649700.56,
      "modelName": "vEOS",
      "version": "4.15.9M"
      [...]
    }
(tto_text(t
AnsibleModule(t
ConnectiontConnectionErrorcC`s�tdtdddt�dtdddt�dtdddt�dtdd	d
tdt�dtdd	d
tdt�dtdd	d
tdt��}ddgg}td
|d|dt�}|jr|jdjd�r|jdd|jd�nt�}itd6|d6}t	|j
�}d}y|j|j�}Wn/tk
rz}|jdt
|dd��nX|jds�y|j|�|d<Wntk
r�nX|ji|d6�n|j|�dS(s%entry point for module execution
    tcommandttypetstrtrequiredtprompttlisttanswertnewlinetbooltdefaulttsendonlyt	check_allt
argument_spectrequired_togethertsupports_check_modetshowtmsgsHOnly show commands are supported when using check_mode, not executing %stchangedtwarningstterrorstsurrogate_then_replacetjsontstdoutN(tdicttTruetFalseR	t
check_modetparamst
startswitht	fail_jsonRR
t_socket_pathtgetRRt	from_jsont
ValueErrortupdatet	exit_json(RRtmoduleRtresultt
connectiontresponsetexc((sK/usr/lib/python2.7/site-packages/ansible/modules/network/cli/cli_command.pytmain�s<	 		 

	t__main__N(t
__future__RRRR
t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils._textRtansible.module_utils.basicR	tansible.module_utils.connectionR
RR6t__name__(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/cli/cli_command.pyt<module>s


6/	,

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