mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix playbook includes so tags are obeyed (v2)
This commit is contained in:
parent
daf533c80e
commit
7b1c6fbab9
3 changed files with 11 additions and 2 deletions
|
@ -61,10 +61,11 @@ class PlaybookInclude(Base, Taggable):
|
|||
|
||||
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
|
||||
|
||||
|
|
6
samples/included_playbook.yml
Normal file
6
samples/included_playbook.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
- hosts: localhost
|
||||
gather_facts: no
|
||||
tags:
|
||||
- included
|
||||
tasks:
|
||||
- debug: msg="incuded playbook, variable is {{a}}"
|
2
samples/test_playbook.include
Normal file
2
samples/test_playbook.include
Normal file
|
@ -0,0 +1,2 @@
|
|||
- include: included_playbook.yml a=1
|
||||
tags: include
|
Loading…
Reference in a new issue