more freedom and options for `run_once`

12 views
Skip to first unread message

Uffi Schnuffi

unread,
Apr 2, 2019, 7:47:25 AM4/2/19
to Ansible Project
Currently something like the following:

```
- <some action>
  run_once: true
  when: item == true
  with_random_choice:
    - true
    - false
```

Will run only once even when the task is skipped (`item = false`).

There are cases when it is desired to run a task until it was run successfully for the first time.

What if `run_once` offered a bit more options?

`run_once: success`: Run until the task is successfully run on a host
`run_once: not_skipped`: Run until task was not skipped



Or an additional task keyword (which sounds even better):

`run_until: <Any statement may be used that can also be used in when>`

That would allow great freedom in deciding until when a task is run. 

It also separates well from the `until` task keyword which is used with `retries`.


Git issues about the current limitation:

Threads:


What do you think?


Brian Coca

unread,
Apr 3, 2019, 3:52:36 PM4/3/19
to Ansible Project
I've really regretted the naming of this feature, its really
`run_on_first_active_host_in_play_execution_apply_facts_and_register_to_all`
, I don't think we can change the current nature of run_once from
boolean to string choices, but I am in favor of a new option that does
a better job of specifying conditions.

----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages