- name: Run install command with prompts
expect:
command: "install_command_with_prompts"
responses:
"Please enter a value:": "value1"
"Please enter another value:": "value2"
这个任务使用expect模块运行一个名为“install_command_with_prompts”的命令,并在提示出现时提供相应的响应。在本示例中,当提示“Please enter a value:”出现时,自动输入“value1”作为响应;当提示“Please enter another value:”出现时,自动输入“value2”作为响应。