问题
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):
The <command> <option>
asks for four variables that can be hardcoded in the playbook.
Thank you for any insight you can provide
回答1:
Use expect
module:
- hosts: localhost
tasks:
- expect:
command: command option
responses:
username: "John Doe"
email: "joh@doe.com"
password: "mypass"
来源:https://stackoverflow.com/questions/38264206/how-to-process-a-command-asking-for-inputs-with-an-ansible-task