ansible-lint
由于运行时身份验证错误,gitlab-ci 管道中的步骤失败,该错误会ansible-galaxy install -r requirements.yml
提取 中定义的角色依赖项requirements.yml
并从 git 克隆角色。
我尝试通过 CICD 变量传递身份验证令牌,但它不喜欢那样。
需求.yml
- src: git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/../ansible/roles/ansible-role-s3-yumrepo.git
version: master
scm: git
但它失败并出现以下错误
Starting galaxy role install process
[WARNING]: - ansible-role-s3-yumrepo was NOT installed successfully: -
command /usr/bin/git clone https://gitlab-ci-
token:${CI_JOB_TOKEN}@gitlab.com/../ansible/roles/ansible-role-s3-yumrepo.git
ansible-role-s3-yumrepo failed in directory /root/.ansible/tmp/ansible-local-526mx2pctt4/tmp2n3_tp7_
(rc=128) - Cloning into 'ansible-role-s3-yumrepo'... remote: HTTP Basic:
Access denied fatal: Authentication failed for 'https://gitlab-ci-
token:${CI_JOB_TOKEN}@gitlab.com/../ansible/roles/ansible-role-s3-yumrepo.git/'
任何人之前都遇到过这个问题或知道更好的方法来处理这个问题(已编辑)