diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 06e5ffc6ef0..0696987f340 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -213,7 +213,8 @@ class Play(object): role_vars = {} if type(orig_path) == dict: # what, not a path? - role_name = utils.role_yaml_parse(orig_path)["name"] + parsed_role = utils.role_yaml_parse(orig_path) + role_name = parsed_role.get('role', parsed_role.get('name')) if role_name is None: raise errors.AnsibleError("expected a role name in dictionary: %s" % orig_path) role_vars = orig_path