当前位置:  开发笔记 > 运维 > 正文

Ansible playbook使用私有git角色依赖

如何解决《Ansibleplaybook使用私有git角色依赖》经验,为你挑选了0个好方法。

我有一个问题是运行带有一组私有角色的Ansible playbook(即私有git存储库中的Ansible角色).

例如,我有一个使用base依赖的角色的剧本,这dep两个角色都托管在私人git存储库中.运行ansible-galaxy提取并安装所有角色和依赖项,但以后ansible-playbook无法使用正确的角色名称.

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'}

我尝试使用备用角色名称系统作为依赖项:

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

哪个好,ansible-galaxy但仍然ansible-playbook失败......

$ 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 /roles/git+ssh://git@10.0.0.1/ansible/role-dep.git,,dep or /git+ssh://git@10.0.0.1/ansible/role-dep.git,,dep or /ansible-roles/git+ssh://git@10.0.0.1/ansible/role-dep.git,,dep

有没有办法正确使用私人回购的角色依赖?

推荐阅读
家具销售_903
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有