暂停可播放的剧本以供用户确认,是否运行休息任务 [英] pause ansible playbook for user confirmation, whether to run rest tasks

查看:87
本文介绍了暂停可播放的剧本以供用户确认,是否运行休息任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行ansible-playbook,其中列出了许多任务.它们全部用来逐个运行,但是我想在特定任务完成后pause剧本,询问用户是否要继续运行其余任务或退出.我已经看过ansible的pause module,但是看不到任何要求用户输入yes或no的示例,而后者又继续相应地退出了ansible-playbook.

I am running an ansible-playbook which have many tasks listed. All of them use to get run one by one, but I want to pause the playbook after a particular tasks to asks the user if he wants to continue running the rest of the tasks or exit. I have seen the pause module of ansible but couldn't see any example which asks users for yes or no which in turn continue or exit the ansible-playbook accordingly.

推荐答案

pause模块实际上正是这样做的.但是,它不能让您选择回答yesno.相反,它希望用户先按 Ctrl + C ,然后按 a 放弃.要继续,用户只需按 Enter .

The pause module actually does exactly that. But it does not give you an option to answer yes or no. Instead it expects the user to press Ctrl+C and then a for abort. To continue the user simply needs to press Enter.

由于这对用户而言并不十分明显,因此可以在prompt参数中对其进行描述.

Since this is not perfectly obvious to the user you can describe it in the prompt parameter.

- name: Exterminate mankind
  pause:
    prompt: Please confirm you want to exterminate mankind! Press return to continue. Press Ctrl+c and then "a" to abort

这篇关于暂停可播放的剧本以供用户确认,是否运行休息任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆