Add ansible import vs include
This commit is contained in:
parent
15a570ea45
commit
fc2f18838b
1 changed files with 17 additions and 1 deletions
|
@ -33,4 +33,20 @@ To tell Jinja2 to not mess with carriage return in templates add
|
||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
|
||||||
at the top of the template file
|
at the top of the template file
|
||||||
|
|
||||||
|
## Import vs include (kudos @href)
|
||||||
|
|
||||||
|
If you want to exec a sets of tasks when a condition is true, use
|
||||||
|
import_tasks.
|
||||||
|
|
||||||
|
```
|
||||||
|
- name: Include init tasks
|
||||||
|
import_tasks: init.yml
|
||||||
|
tags:
|
||||||
|
- init
|
||||||
|
when: proof.stat.exists == False
|
||||||
|
```
|
||||||
|
|
||||||
|
`ìnclude_tasks` will add all tasks to play run, even if the when condition is
|
||||||
|
false.
|
Loading…
Reference in a new issue