I have a playbook with includes:
- include: include1.yml
when: doinclude | default('true')
- include: include2.yml
when: doinclude | default('true')
Is there any possibility not to repeat the condition? I tried blocks but it seems blocks cannot be used in that context:
- block:
- include: include1.yml
- include: include2.yml
when: doinclude | default('true')
Is there any way to do that? I also tried something like
- name: test
hosts: all
tasks:
- block:
- include: include1.yml
- include: include2.yml
when: doinclude | default('true')
which also does not work
This syntax works fine in ansible 2.1.1 (be accurate with indentation):
---
- hosts: localhost
tasks:
- block:
- include: include1.yml
- include: include2.yml
when: doinclude | default('true')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With