我使用ansible-galaxy (v2.0.0.2)通过requirements.yml文件在Bitbucket上安装了具有源代码的ansible roles。但我无法用私钥从bitbucket.org中检出代码。这是错误消息,还有我的requirements.yml
内容。
有人知道ansible-galaxy 2.0.0.2的正确requirements.yml
文件格式是什么吗?
+ 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.
requirements.yml
- name: nginx
src: git@bitbucket.org:myrepo/nginx.git
scm: git
version: latest
accept_hostkey: yes
key_file: /tmp/.ssh/id_rsa
发布于 2017-01-20 05:35:45
可能scp语法不起作用。url可能是:
ssh://git@bitbucket.org/myrepo/nginx.git
尝试,就像在this ansible issue中一样
从github克隆存储库路径直接拷贝
git@github.com:geerlingguy/ansible-role-php.git
实际有效的URL
ssh://git@github.com/geerlingguy/ansible-role-php.git
您必须将
:
替换为/
。
而且它必须是一个URL (即包含://
),否则ansible-galaxy会假定它是一个文件系统路径。
发布于 2019-03-12 18:11:02
尝试git+ssh
架构
在ansible-galaxy 2.7.8上工作
ansible-galaxy install git+ssh://bitbucket.org:<username>/<role-name>.git
发布于 2019-07-29 20:07:59
如果您在src下面设置了"scm: git“,galaxy将运行"git clone XYZ”,其中XYZ是您的src:字段。所以,您可以"git clone XYZ“的任何内容都是您在src字段中输入的内容。
- src: ssh://git@bitbucket.internal.com:8899/project/repo-name.git
scm: git
对于私钥,如果它不是您的默认ssh密钥,我们使用ssh-agent(1) (有关用法,请参阅手册页)。
https://stackoverflow.com/questions/41755543
复制