You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3770,6 +3770,47 @@ tasks:
3770
3770
- If inventory file is not found, dibra errors
3771
3771
- Circular group references are detected and reported
3772
3772
3773
+
## when
3774
+
3775
+
Conditionally executes a task. The condition is evaluated against the same variable context used for templates (`vars`, `hostvars`, `inventory_hostname`, `group_names`, registered results, etc.). If the condition resolves to false, the task is skipped. If the condition cannot be evaluated, the task fails.
- Skipped tasks report `skipped: true`, `changed: false`, and `msg: "when condition false"` in register results.
3811
+
- `include_tasks`: if the `when` condition is false, no tasks are included.
3812
+
- `import_tasks`: parent `when` conditions are merged with imported task conditions (logical AND).
3813
+
3773
3814
## import_tasks
3774
3815
3775
3816
Imports a list of tasks from another YAML file, inserting them into the current playbook at parse time (static include). This is a controller-side directive, not a remote module.
0 commit comments