Repository: ansible/ansible

Issue:
Bug: Private role repository in role dependency during playbook
##### Issue Type:

Bug report
##### Ansible Version:

```
$  ansible --version
ansible 1.9.4
  configured module search path = None
```
##### Ansible Configuration:

Ansible config is 'local' folder, nothing taken from /etc/ansible/*

```
$ cat ansible.cfg
[defaults]
host_key_checking = False
roles_path = ansible-roles
hostfile = inventory

[ssh_connection]
scp_if_ssh = True
```
##### Environment:

Ubuntu 14.04
##### Summary:

Using a role in a private (non-Galaxy) git repo which has a dependency on a similar private (non-Galaxy) role works when pulling the roles with `ansible-galaxy` but fails when running `ansible-playbook`.
##### Steps To Reproduce:

See GitHub:
- https://github.com/TimJones/ansible-bug-test-playbook.git
- https://github.com/TimJones/ansible-bug-test-role.git
- https://github.com/TimJones/ansible-bug-test-dependency-role.git

```
$ git clone https://github.com/TimJones/ansible-bug-test-playbook.git
Cloning into 'ansible-bug-test-playbook'...
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 8 (delta 0), reused 8 (delta 0), pack-reused 0
Unpacking objects: 100% (8/8), done.
Checking connectivity... done.

$ ansible-galaxy install -r requirements.yml
- executing: git clone https://github.com/TimJones/ansible-bug-test-role.git ansible-bug-test-role
- executing: git archive --prefix=ansible-bug-test-role/ --output=/tmp/tmpLVN92w.tar HEAD
- extracting ansible-bug-test-role to roles/ansible-bug-test-role
- ansible-bug-test-role was installed successfully
- adding dependency: ansible-bug-test-dependency
- executing: git clone https://github.com/TimJones/ansible-bug-test-dependency-role.git ansible-bug-test-dependency
- executing: git archive --prefix=ansible-bug-test-dependency/ --output=/tmp/tmpOleek8.tar HEAD
- extracting ansible-bug-test-dependency to roles/ansible-bug-test-dependency
- ansible-bug-test-dependency was installed successfully
```
##### Expected Results:

```
$ ansible-playbook play.yml

PLAY [test] *******************************************************************

GATHERING FACTS *************************************************************** 
ok: [localhost]

TASK: [ansible-bug-test-dependency | debug msg="This is the dependency role, say '{{ dep_msg }}'"] *** 
ok: [localhost] => {
    "msg": "This is the dependency role, say 'Hello from test-role'"
}

TASK: [ansible-bug-test-role | debug msg="This is the test role"] ************* 
ok: [localhost] => {
    "msg": "This is the test role"
}

PLAY RECAP ******************************************************************** 
localhost                  : ok=3    changed=0    unreachable=0    failed=0   
```
##### Actual Results:

```
$ ansible-playbook play.yml 
ERROR: expected a role name in dictionary: {'scm': 'git', 'src': 'https://github.com/TimJones/ansible-bug-test-dependency-role.git', 'dep_msg': 'Hello from test-role', 'name': 'ansible-bug-test-dependency'}
```



Discussion:
Looking at [this code](https://github.com/ansible/ansible/blob/v1.9.4-1/lib/ansible/playbook/play.py#L214-L221) (lib/ansible/playbook/play.py, tag v1.9.4-1) it looks like the YAML dict is not being parsed with [`utils.role_yaml_parse`](https://github.com/ansible/ansible/blob/v1.9.4-1/lib/ansible/utils/__init__.py#L420-L451) as it should to pull out the actual role name, instead the key `role` is assume to be present as in the old style.


Resolving patch:
diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py
--- a/lib/ansible/playbook/play.py
+++ b/lib/ansible/playbook/play.py
@@ -213,7 +213,7 @@ def _get_role_path(self, role):
         role_vars = {}
         if type(orig_path) == dict:
             # what, not a path?
-            role_name = orig_path.get('role', None)
+            role_name = utils.role_yaml_parse(orig_path)["name"]
             if role_name is None:
                 raise errors.AnsibleError("expected a role name in dictionary: %s" % orig_path)
             role_vars = orig_path


Test patch: