parent role name in name of task bug with includes ?

For information,

I have a role for which in role/r/tasks/main.yml I include tasks from a file.
All the included tasks seem to miss the “r|” in their name.

it seems like a bug.

Jerome

Yes, I will modify the patch, that is indeed an unintended consequence.

That should be fixed if you’d like to pull and re-test.

Hello,

I was looking in the code while you answered. The problem might be in playbook/play.py :

new_role = None
if ‘role_name’ in x:
new_role = x[‘role_name’]

instead of

new_role = role_name
if ‘role_name’ in x:
new_role = x[‘role_name’]

hope this helps

This is really more of a discussion for ansible-devel, but yes that’s the part that was causing it, however the change I did was this:

if os.path.isfile(handler):

  • nt = dict(include=pipes.quote(handler), vars=role_vars, role_name=role[‘role’])
  • nt = dict(include=pipes.quote(handler), vars=role_vars)

Since the role name does not exist in the data, it won’t be pre-pended to the handler’s task name, so the notifications should be able to find it once again.