|
|
@ -21,14 +21,16 @@ __metaclass__ = type
|
|
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.errors import AnsibleParserError
|
|
|
|
from ansible.parsing.splitter import split_args, parse_kv
|
|
|
|
from ansible.parsing.splitter import split_args, parse_kv
|
|
|
|
from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject, AnsibleMapping
|
|
|
|
from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject, AnsibleMapping
|
|
|
|
from ansible.playbook.attribute import FieldAttribute
|
|
|
|
from ansible.playbook.attribute import FieldAttribute
|
|
|
|
from ansible.playbook.base import Base
|
|
|
|
from ansible.playbook.base import Base
|
|
|
|
|
|
|
|
from ansible.playbook.conditional import Conditional
|
|
|
|
from ansible.playbook.taggable import Taggable
|
|
|
|
from ansible.playbook.taggable import Taggable
|
|
|
|
from ansible.errors import AnsibleParserError
|
|
|
|
from ansible.template import Templar
|
|
|
|
|
|
|
|
|
|
|
|
class PlaybookInclude(Base, Taggable):
|
|
|
|
class PlaybookInclude(Base, Conditional, Taggable):
|
|
|
|
|
|
|
|
|
|
|
|
_name = FieldAttribute(isa='string')
|
|
|
|
_name = FieldAttribute(isa='string')
|
|
|
|
_include = FieldAttribute(isa='string')
|
|
|
|
_include = FieldAttribute(isa='string')
|
|
|
@ -52,6 +54,14 @@ class PlaybookInclude(Base, Taggable):
|
|
|
|
# playbook objects
|
|
|
|
# playbook objects
|
|
|
|
new_obj = super(PlaybookInclude, self).load_data(ds, variable_manager, loader)
|
|
|
|
new_obj = super(PlaybookInclude, self).load_data(ds, variable_manager, loader)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_vars = dict()
|
|
|
|
|
|
|
|
if variable_manager:
|
|
|
|
|
|
|
|
all_vars = variable_manager.get_vars(loader=loader)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templar = Templar(loader=loader, variables=all_vars)
|
|
|
|
|
|
|
|
if not new_obj.evaluate_conditional(templar=templar, all_vars=all_vars):
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
# then we use the object to load a Playbook
|
|
|
|
# then we use the object to load a Playbook
|
|
|
|
pb = Playbook(loader=loader)
|
|
|
|
pb = Playbook(loader=loader)
|
|
|
|
|
|
|
|
|
|
|
|