diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py index 06681abe763..39a6559235f 100644 --- a/lib/ansible/playbook/base.py +++ b/lib/ansible/playbook/base.py @@ -442,7 +442,7 @@ class Base: new_value = [ new_value ] #return list(set(value + new_value)) - return [i for i,_ in itertools.groupby(value + new_value)] + return [i for i,_ in itertools.groupby(value + new_value) if i is not None] def __getstate__(self): return self.serialize() diff --git a/lib/ansible/playbook/block.py b/lib/ansible/playbook/block.py index 3831ed76004..201e881ef4b 100644 --- a/lib/ansible/playbook/block.py +++ b/lib/ansible/playbook/block.py @@ -323,8 +323,9 @@ class Block(Base, Become, Conditional, Taggable): Override for the 'tags' getattr fetcher, used from Base. ''' environment = self._attributes['environment'] - if environment is None: - environment = self._get_parent_attribute('environment', extend=True) + parent_environment = self._get_parent_attribute('environment', extend=True) + if parent_environment is not None: + environment = self._extend_value(environment, parent_environment) return environment diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 8c288fc1d4e..8a3d4c4a603 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -383,8 +383,8 @@ class Task(Base, Conditional, Taggable, Become): Override for the 'tags' getattr fetcher, used from Base. ''' environment = self._attributes['environment'] - if environment is None: - environment = self._get_parent_attribute('environment') - + parent_environment = self._get_parent_attribute('environment', extend=True) + if parent_environment is not None: + environment = self._extend_value(environment, parent_environment) return environment