Skip to content

Commit

Permalink
Fix playbook includes so tags are obeyed (v2)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimi-c committed May 11, 2015
1 parent daf533c commit 7b1c6fb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ansible/playbook/playbook_include.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ def load_data(self, ds, basedir, variable_manager=None, loader=None):

pb._load_playbook_data(file_name=file_name, variable_manager=variable_manager)

# finally, playbook includes can specify a list of variables, which are simply
# used to update the vars of each play in the playbook
# finally, update each loaded playbook entry with any variables specified
# on the included playbook and/or any tags which may have been set
for entry in pb._entries:
entry.vars.update(new_obj.vars)
entry.tags = list(set(entry.tags).union(new_obj.tags))

return pb

Expand Down
6 changes: 6 additions & 0 deletions samples/included_playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- hosts: localhost
gather_facts: no
tags:
- included
tasks:
- debug: msg="incuded playbook, variable is {{a}}"
2 changes: 2 additions & 0 deletions samples/test_playbook.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- include: included_playbook.yml a=1
tags: include

0 comments on commit 7b1c6fb

Please sign in to comment.