How to process a command asking for inputs with an

2019-07-14 00:29发布

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条回答
贼婆χ
2楼-- · 2019-07-14 00:34

Use expect module:

- hosts: localhost
  tasks:
    - expect:
        command: command option
        responses:
          username: "John Doe"
          email: "joh@doe.com"
          password: "mypass"
查看更多
登录 后发表回答