Add parameterized playbook includes

Also makes with_* work with them.

Fixes #1162.
This commit is contained in:
Daniel Hokka Zakrisson
2012-11-09 13:09:20 +01:00
parent 383dc30560
commit 9c095b72b9
4 changed files with 67 additions and 8 deletions

View File

@@ -204,6 +204,27 @@ class TestPlaybook(unittest.TestCase):
assert len(EVENTS) == 44
def test_includes(self):
pb = os.path.join(self.test_dir, 'playbook-includer.yml')
actual = self._run(pb)
# if different, this will output to screen
print "**ACTUAL**"
print utils.jsonify(actual, format=True)
expected = {
"localhost": {
"changed": 0,
"failures": 0,
"ok": 5,
"skipped": 0,
"unreachable": 0
}
}
print "**EXPECTED**"
print utils.jsonify(expected, format=True)
assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True)
def test_playbook_vars(self):
test_callbacks = TestCallbacks()
playbook = ansible.playbook.PlayBook(

View File

@@ -0,0 +1,5 @@
---
- hosts: all
gather_facts: False
tasks:
- action: debug msg="$variable"

View File

@@ -0,0 +1,8 @@
---
- include: playbook-included.yml variable=foobar
- include: playbook-included.yml variable=foofoo
- include: playbook-included.yml variable=$item
with_items:
- foo
- bar
- baz