관리-도구
편집 파일: expect.cpython-39.pyc
a �)gO! � @ s� d dl mZmZmZ eZdZdZd dlZd dl Z d dl Z dZzd dlZdZ W n eyj e �� ZdZ Y n0 d dlmZmZ d dlmZmZmZ d d � Zdd� Zed kr�e� dS )� )�absolute_import�division�print_functionaX --- module: expect version_added: '2.0' short_description: Executes a command and responds to prompts description: - The C(expect) module executes a command and responds to prompts. - The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like C($HOME) and operations like C("<"), C(">"), C("|"), and C("&") will not work. options: command: description: - The command module takes command to run. required: true type: str creates: type: path description: - A filename, when it already exists, this step will B(not) be run. removes: type: path description: - A filename, when it does not exist, this step will B(not) be run. chdir: type: path description: - Change into this directory before running the command. responses: type: dict description: - Mapping of expected string/regex and string to respond with. If the response is a list, successive matches return successive responses. List functionality is new in 2.1. required: true timeout: type: int description: - Amount of time in seconds to wait for the expected strings. Use C(null) to disable timeout. default: 30 echo: description: - Whether or not to echo out your response strings. default: false type: bool requirements: - python >= 2.6 - pexpect >= 3.3 extends_documentation_fragment: action_common_attributes attributes: check_mode: support: none diff_mode: support: none platform: support: full platforms: posix notes: - If you want to run a command through the shell (say you are using C(<), C(>), C(|), and so on), you must specify a shell in the command such as C(/bin/bash -c "/path/to/something | grep else"). - The question, or key, under I(responses) is a python regex match. Case insensitive searches are indicated with a prefix of C(?i). - The C(pexpect) library used by this module operates with a search window of 2000 bytes, and does not use a multiline regex match. To perform a start of line bound match, use a pattern like ``(?m)^pattern`` - By default, if a question is encountered multiple times, its string response will be repeated. If you need different responses for successive question matches, instead of a string response, use a list of strings as the response. The list functionality is new in 2.1. - The M(ansible.builtin.expect) module is designed for simple scenarios. For more complex needs, consider the use of expect code with the M(ansible.builtin.shell) or M(ansible.builtin.script) modules. (An example is part of the M(ansible.builtin.shell) module documentation). seealso: - module: ansible.builtin.script - module: ansible.builtin.shell author: "Matt Martz (@sivel)" a� - name: Case insensitive password string match ansible.builtin.expect: command: passwd username responses: (?i)password: "MySekretPa$$word" # you don't want to show passwords in your logs no_log: true - name: Generic question with multiple different responses ansible.builtin.expect: command: /path/to/custom/command responses: Question: - response1 - response2 - response3 NTF)� AnsibleModule�missing_required_lib)�to_bytes� to_native�to_textc s"