我是 ansible 的新手,正在尝试学习基本的东西......
我正在尝试使用 ansible 执行下面的 shell 脚本...该脚本包含需要用户输入的情况条件。但是在 ansible 中运行时,它不会询问任何内容并完成任务。我希望我的 ansible 在执行期间询问 ai/p 并相应地执行脚本。
- hosts: localhost
tasks:
- name: Execute the script
shell: /usr/bin/sh /root/ansible_testing/testing.sh
Run Code Online (Sandbox Code Playgroud)
shell脚本的片段是...
echo "Press 1 for Backup"
echo "Press 2 for MakeChange"
echo "Press 3 for Keepsafe"
echo "*******************************************"
echo -n "Enter your choice : "
read choice2
case $choice2 in
1)
echo "Hello"
Run Code Online (Sandbox Code Playgroud) ansible ×1