Fix nested noop block padding in dynamic includes (#38814)

* Fix nested noop block padding in dynamic includes

* Address issues from the review

* Fix typo
This commit is contained in:
Martin Krizek
2018-04-26 22:14:31 +02:00
committed by Matt Martz
parent 4b01b92cfe
commit 5dd8977cfa
7 changed files with 74 additions and 11 deletions

View File

@@ -0,0 +1 @@
posix/ci/group3

View File

@@ -0,0 +1,6 @@
- name: Include tasks
include_tasks: "tasks.yml"
- name: Mark role as finished
set_fact:
role1_complete: True

View File

@@ -0,0 +1,7 @@
- name: Call role2
include_role:
name: role2
- name: Call role2 again
include_role:
name: role2

View File

@@ -0,0 +1,7 @@
- block:
- block:
- name: Nested task 1
debug: msg="Nested task 1"
- name: Nested task 2
debug: msg="Nested task 2"

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eux
ansible-playbook test_include_file_noop.yml -i ../../inventory "$@"

View File

@@ -0,0 +1,16 @@
- hosts:
- testhost
- testhost2
gather_facts: no
vars:
secondhost: testhost2
tasks:
- name: Call the first role only on one host
include_role:
name: role1
when: inventory_hostname is match(secondhost)
- name: Make sure nothing else runs until role1 finishes
assert:
that:
- "'role1_complete' in hostvars[secondhost]"