Ash*_*ker 4 shell user-input ansible
我想使用 ansible 运行 shell 脚本,但 shell 脚本需要用户输入才能成功执行,
例如:我的 shell 脚本询问一个 的唯一 id ossec agent,通过 ansible 我可以预定义我的unique id (user input)。
小智 5
您需要使用 EXPECT 模块: https://docs.ansible.com/ansible/latest/modules/expect_module.html
- name: Case insensitive unique id string match
expect:
command: ./myscript.sh
responses:
"Please enter your uniqueid": "myID"
# Your input in myscript.sh
no_log: true
Run Code Online (Sandbox Code Playgroud)
要求
执行此模块的主机需要满足以下要求。
蟒蛇 >= 2.6
预期 >= 3.3
| 归档时间: |
|
| 查看次数: |
7930 次 |
| 最近记录: |