有没有办法在成功的条件下运行一系列任务? 这就是我想要实现的目标:
- start sequence below
task running shell command to generate kerberos ticket
task wait_for_connection
retry sequence x times until wait_for connection is successful
实现它的最佳方法是什么?似乎'阻止'不是为此目的而设计的。
答案 0 :(得分:1)
恐怕没有解决方案。 " include_tasks"如果"直到"与" include_tasks"一起使用。不是https://github.com/ansible/ansible/issues/17098
有一个功能请求打开:"直到阻止" https://github.com/ansible/ansible/issues/16621
是不是可以把"命令&&等待"进入一项任务?
答案 1 :(得分:1)
看看我刚刚实现的以递归方式更改目录权限的过程:
---
- set_fact:
parent_path: "{{ parent_path | default(myoriginal_path) | dirname }}"
- name: Configure acl for {{ parent_path }}
debug:
msg: "{{ parent_path }}"
- name: Run this file until getting /
include_tasks: "{{ _ansible_item_label }}.yml"
when: parent_path != '/'