mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Introduce the 'always_run' task clause.
The 'always_run' task clause allows one to execute a task even in check mode. While here implement Runner.noop_on_check() to check if a runner really should execute its task, with respect to check mode option and 'always_run' clause. Also add the optional 'jinja2' argument to check_conditional() : it allows to give this function a jinja2 expression without exposing the 'jinja2_compare' implementation mechanism.
This commit is contained in:
@@ -1060,6 +1060,29 @@ Example::
|
||||
|
||||
ansible-playbook foo.yml --check
|
||||
|
||||
Running a task in check mode
|
||||
````````````````````````````
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
Sometimes you may want to have a task to be executed even in check
|
||||
mode. To achieve this use the `always_run` clause on the task. Its
|
||||
value is a Python expression, just like the `when` clause. In simple
|
||||
cases a boolean YAML value would be sufficient as a value.
|
||||
|
||||
Example::
|
||||
|
||||
tasks:
|
||||
|
||||
- name: this task is run even in check mode
|
||||
command: /something/to/run --even-in-check-mode
|
||||
always_run: yes
|
||||
|
||||
As a reminder, a task with a `when` clause evaluated to false, will
|
||||
still be skipped even if it has a `always_run` clause evaluated to
|
||||
true.
|
||||
|
||||
|
||||
Showing Differences with --diff
|
||||
```````````````````````````````
|
||||
|
||||
|
||||
Reference in New Issue
Block a user