ezl*_*lee 6 git bitbucket ansible ansible-galaxy
我正在使用ansible-galaxy(v2.0.0.2)来安装ansible角色,该角色通过requirements.yml文件在Bitbucket上具有源代码。但是我无法使用私钥从bitbucket.org检出代码。这是错误消息,也是我的requirements.yml内容。
请问requirements.ymlansible-galaxy 2.0.0.2 的正确文件格式是什么?
+ ansible-galaxy -vvv install --force --role-file ansible/requirements.yml --roles-path ./ansible/roles
Using /etc/ansible/ansible.cfg as config file
Opened /tmp/.ansible_galaxy
found role {'scm': 'git', 'src': 'git@bitbucket.org:myrepo/nginx.git', 'version': 'latest', 'name': 'nginx'} in yaml file
Installing role nginx
[WARNING]: - nginx was NOT installed successfully: - command git checkout
latest failed in directory /tmp/tmpQRZc8j (rc=1)
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
Run Code Online (Sandbox Code Playgroud)
[requirements.yml]
- name: nginx
src: git@bitbucket.org:myrepo/nginx.git
scm: git
version: latest
accept_hostkey: yes
key_file: /tmp/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
也许 scp 语法不起作用。网址可能是:
ssh://git@bitbucket.org/myrepo/nginx.git
Run Code Online (Sandbox Code Playgroud)
尝试一下,就像在这个 ansible 问题中一样:
直接从github克隆仓库路径复制
git@github.com:geerlingguy/ansible-role-php.git
Run Code Online (Sandbox Code Playgroud)
实际有效的 URL
ssh://git@github.com/geerlingguy/ansible-role-php.git
Run Code Online (Sandbox Code Playgroud)
您必须将 替换
:为/.
它必须是一个 URL(即 contains://),否则 ansible-galaxy 会假设它是一个文件系统路径。