Ansible:运行失败的任务

kha*_*iuk 7 ansible ansible-playbook

我正在写一本剧本.我的工作流程如下:

  • 添加任务或一些任务
  • 运行剧本
  • 如果失败:改变一些东西并返回上一步

如果剧本足够长,则需要花费大量时间重新播放剧本.有没有办法只运行最后一个(失败的)任务?或者你能提出另一种方法来加快剧本创作过程吗?

Vor*_*Vor 8

你可以使用--start-at-task参数ansible-playbook

--start-at-task=START_AT
      start the playbook at the task matching this name
Run Code Online (Sandbox Code Playgroud)

另一种选择是使用--step参数,允许您单步执行剧本并决定运行什么.