From fc2f18838bdedab880cb48711e651213397877b9 Mon Sep 17 00:00:00 2001 From: Wilfried OLLIVIER Date: Wed, 26 Jun 2019 12:11:43 +0200 Subject: [PATCH] Add ansible import vs include --- src/ops/tools/ansible.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ops/tools/ansible.md b/src/ops/tools/ansible.md index 268efc1..afe49e9 100644 --- a/src/ops/tools/ansible.md +++ b/src/ops/tools/ansible.md @@ -33,4 +33,20 @@ To tell Jinja2 to not mess with carriage return in templates add --- ``` -at the top of the template file \ No newline at end of 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. \ No newline at end of file