Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions lib/ansible/playbook/role/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,31 @@ def load(role_include, play, parent_role=None, from_files=None, from_include=Fal
# specified for a role as the key and the Role() object itself.
# We use frozenset to make the dictionary hashable.

params = role_include.get_role_params()
if role_include.when is not None:
params['when'] = role_include.when
if role_include.tags is not None:
params['tags'] = role_include.tags
if from_files is not None:
params['from_files'] = from_files
# This grabs the vars from the dep_chain which if you're paranoid might
# warrant re-running the role but I wouldn't notice.
#params = role_include.get_role_params()
params = {}
#if role_include.when is not None:
# params['when'] = role_include.when
#if role_include.tags is not None:
# params['tags'] = role_include.tags
#if from_files is not None:
# params['from_files'] = from_files
# This is the one that people actually use.
# roles:
# - example
# - role: example
# vars:
# role_var: "blah"
# should be ran twice which enables patterns like
# roles:
# - {role: file_monitor, vars: {path: '/var/log/messages'}}
# - {role: file_monitor, vars: {path: '/var/log/secure'}}
#
if role_include.vars:
params['vars'] = role_include.vars

params['from_include'] = from_include
#params['from_include'] = from_include

hashed_params = hash_params(params)
if role_include.role in play.ROLE_CACHE:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/playbook/role_include.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class IncludeRole(TaskInclude):
# ATTRIBUTES

# private as this is a 'module options' vs a task property
_allow_duplicates = FieldAttribute(isa='bool', default=True, private=True)
_allow_duplicates = FieldAttribute(isa='bool', default=False, private=True)
_public = FieldAttribute(isa='bool', default=False, private=True)

def __init__(self, block=None, role=None, task_include=None):
Expand Down