如何处理Ansible任务要求输入的命令? [英] How to process a command asking for inputs with an Ansible task?
本文介绍了如何处理Ansible任务要求输入的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在学习Ansible,并且想知道如何编写任务来处理以下命令:
I'm learning Ansible and I'm wondering how to write a task to process the following command:
$<command> <options>
username:
email address:
password:
password (check):
<command> <option>
要求提供四个可以在剧本中进行硬编码的变量.
The <command> <option>
asks for four variables that can be hardcoded in the playbook.
感谢您提供的任何见解
推荐答案
使用expect
模块:
- hosts: localhost
tasks:
- expect:
command: command option
responses:
username: "John Doe"
email: "joh@doe.com"
password: "mypass"
这篇关于如何处理Ansible任务要求输入的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文