【发布时间】:2020-06-17 11:09:53
【问题描述】:
我正在使用 ansible shell 模块通过 ansible play 运行 terragrunt 脚本。
Ansible 任务
environment:
AWS_ACCESS_KEY_ID: "{{aws_access_key_id}}"
AWS_SECRET_ACCESS_KEY: "{{aws_secret_access_key}}"
AWS_DEFAULT_REGION: "{{aws_region}}"
AWS_SESSION_TOKEN: "{{aws_session_token}}"
shell: "{{command}}"
这里我将command 作为参数,它看起来像
terragrunt plan --terragrunt-working-dir /workspace/terraform/vpc
在我的 terragrunt 脚本中,一些 terraform 模块从私有的 Github 存储库中引用,它应该作为命令执行的一部分下载。
terraform {
source = "git::https://<accesstoken>@<domanian>/vpc.git?ref=v0.2.0"
}
但是当我运行 ansible 角色时,我从 git 收到身份验证错误,但主机中的 repo 克隆工作正常(没有身份验证问题)。
我遇到了来自 ansible play 而不是来自主机的 git 身份验证问题(现在我的主机是 localhost)
来自 TERRAGRUNT 的错误
error downloading 'https://<token>@<domain>/repo.git?ref=v0.7.0': /usr/local/bin/git exited with 128: Cloning into '/Users/<name>/Projects/terraform/integration/hli/eks/.terragrunt-cache/odeTjZcnAck1LSD4uQ9-Wn_30cQ/xBn6R6SbWXfZ6nabGc-LFpX6RXk'...
fatal: Authentication failed for 'https://<token>@<domain>/repo.git/'
【问题讨论】:
-
请包含您遇到的实际错误输出,因为细节很重要,代码 sn-p 中的缩进也很重要
-
@mdaniel 添加了错误日志(删除了repo access token、domain等敏感内容)
标签: ansible terraform ansible-role terragrunt