gpt4 book ai didi

azure - Ansible Azure 信用

转载 作者:行者123 更新时间:2023-12-03 04:09:22 24 4
gpt4 key购买 nike

我正在尝试在 Azure Public 和 Azure Stack 上配置基础架构。为此,我已按照 official documentation for Ansible 的建议将凭据存储在 $HOME/.azure/credentials 文件中。 。配置如下所示:

[default]
subscription_id=xxx`enter code here`xxx
client=xxxxx`enter code here`
secret=xxxx`enter code here`x
tenant=xxxxx`enter code here`x

[azurestack]
subscription_id=`enter code here`xxxxxx
client=xxxx`enter code here`x
secret=xxxxx`enter code here`
tenant=xxxxxx`enter code here`
cloud_environemnt=`enter code here`x

我尝试按如下方式执行剧本:
sudo ansible-playbook -vvv foo.yml --profile=azurestack

它不适用于 Azure 堆栈。它表示名为 --profile 的操作。谁能指导我如何解决这个问题?

最佳答案

同样Ansible documentation ,他们解释了如何做到这一点:

It is possible to store multiple sets of credentials within the credentials file by creating multiple sections. Each section is considered a profile. The modules look for the [default] profile automatically. Define AZURE_PROFILE in the environment or pass a profile parameter to specify a specific profile.

所以有两种方法,第一种,先导出环境变量:

sudo AZURE_PROFILE=azurestack ansible-playbook -vvv foo.yml

我必须同意第二种方法并不那么明确,...我会尝试使用extra-vars:

sudo ansible-playbook -vvv foo.yml --extra-vars "profile=azurestack"

但完全不确定这一秒是否正确,而且我无法尝试。

关于azure - Ansible Azure 信用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57687634/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com