Unusual play using private git dependency

I have a problem with an Ansible boot record with a set of private roles (i.e. Ansible role in a private git repository).

For example, I have a playbook that uses the base role, which depends on dep , both of which are hosted in private git repositories. ansible-galaxy and install all roles and dependencies as needed, but later ansible-playbook fails to use the correct role name.

play.yml

 - hosts: test roles: - role: base 

requirements.yml

 - name: base src: ssh:// git@10.0.0.1 /ansible/role-base.git scm: git 

role-base/meta/main.yml

 galaxy-info: author: Me description: Test Ansible role dependencies min_ansible_version: 1.9 platforms: Ubuntu dependencies: - name: dep src: ssh:// git@10.0.0.1 /ansible/role-dep.git scm: git 

 $ ansible-galaxy -r requirements.yml - executing: git clone ssh:// git@10.0.0.1 /ansible/role-base.git base - executing: git archive --prefix=base/ --output=/tmp/tmp4YKG7a.tar - extracting base to ansible-roles/base - base was installed successfully - adding dependency: dep - executing: git clone ssh:// git@10.0.0.1 /ansible/role-dep.git dep - executing: git archive --prefix=dep/ --output=/tmp/tmpT2YiW4.tar - extracting base to ansible-roles/dep - dep was installed successfully $ ansible-playbook play.yml ERROR: expected a role name in dictionary: {'scm': 'git', 'src': 'ssh:// git@10.0.0.1 /ansible/role-dep.git', 'name': 'dep'} 

I tried using an alternative role name system as a dependency:

 dependencies: - role: "git+ssh:// git@10.0.0.1 /ansible/role-dep.git,,dep" 

This is normal for ansible-galaxy , but still ansible-playbook fails ...

 $ ansible-galaxy -r requirements.yml - executing: git clone ssh:// git@10.0.0.1 /ansible/role-base.git base - executing: git archive --prefix=base/ --output=/tmp/tmpTcvpDu.tar - extracting base to ansible-roles/base - base was installed successfully - adding dependency: dep - executing: git clone ssh:// git@10.0.0.1 /ansible/role-dep.git dep - executing: git archive --prefix=dep/ --output=/tmp/tmpd726OV.tar - extracting base to ansible-roles/dep - dep was installed successfully $ ansible-playbook play.yml ERROR: cannot find role in <pwd>/roles/git+ssh:// git@10.0.0.1 /ansible/role-dep.git,,dep or <pwd>/git+ssh:// git@10.0.0.1 /ansible/role-dep.git,,dep or <pwd>/ansible-roles/git+ssh:// git@10.0.0.1 /ansible/role-dep.git,,dep 

Is there a way to properly use role dependencies from private repos?

+7
git ansible ansible-playbook
source share
2 answers

Looks like a bug in version 1.9. I created a PR ( https://github.com/ansible/ansible/pull/13802 ), but I doubt it will be merged since Ansible 2.0 has just been released.

+2
source share

In role-base/meta/main.yml you define your role name as dep . Therefore, you call it like this:

 - hosts: test roles: - role: dep 
0
source share

All Articles