Ansible 是否仍适用于在RedHat7上使用pexpect,或者是否有其他方法执行命令并响应提示?
我正试图在Redhat7中为ansible使用pexpect,但无法安装它。我只得到了pexpect.noarch 2.3-11.el7@RHEL7版本。或者pexpect是否有执行命令并响应提示的替代方案?RHEL7附带的Ansible 是否仍适用于在RedHat7上使用pexpect,或者是否有其他方法执行命令并响应提示?,ansible,pexpect,Ansible,Pexpect,我正试图在Redhat7中为ansible使用pexpect,但无法安装它。我只得到了pexpect.noarch 2.3-11.el7@RHEL7版本。或者pexpect是否有执行命令并响应提示的替代方案?RHEL7附带的pexpectPython模块的版本对于Ansible来说太旧了(RHEL7有pexpect 2.3,Ansible需要3.3或更高版本)。您最好的选择可能是使用shell或命令模块运行expect;下面是一个例子: # You can use shell to run ot
pexpect
Python模块的版本对于Ansible来说太旧了(RHEL7有pexpect 2.3,Ansible需要3.3或更高版本)。您最好的选择可能是使用shell
或命令
模块运行expect
;下面是一个例子:
# You can use shell to run other executables to perform actions inline
- name: Run expect to wait for a successful PXE boot via out-of-band CIMC
shell: |
set timeout 300
spawn ssh admin@{{ cimc_host }}
expect "password:"
send "{{ cimc_password }}\n"
expect "\n{{ cimc_name }}"
send "connect host\n"
expect "pxeboot.n12"
send "\n"
exit 0
args:
executable: /usr/bin/expect
delegate_to: localhost