【问题标题】:Ansible aws_ec2 plugin how to set credentials for discovered hosts?Ansible aws_ec2 插件如何为发现的主机设置凭据?
【发布时间】:2020-04-09 09:11:30
【问题描述】:

需要在现有 ec2 实例上启动诸如“-m ping”之类的 ad-hook 命令,但它需要密钥对。

如何为 boto 设置密钥对,例如存储在 ~/.aws/credentials 中的“aws_access_key_id”?

另外,有一个问题清单: 我在 Ansible 附近找到了“invertory”文件夹,其中存储了本地主机和 aws_ec2.yml 文件。但是 ansible-invertory --list 仅适用于 aws_ec2.yml 文件...

【问题讨论】:

    标签: amazon-ec2 ansible


    【解决方案1】:

    您可以在inventory 文件中声明适当的凭据和其他主机敏感变量。

    即:

    [ec2fleet]
    35.... ansible_ssh_user=ec2-user
    15.... ansible_ssh_user=ubuntu
    [ec2fleet:vars]
    ansible_user=deployer
    ansible_ssh_private_key_file=/home/deployer/.ssh/deployer.pem
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-02
      • 1970-01-01
      • 2018-04-29
      • 1970-01-01
      • 1970-01-01
      • 2015-04-27
      • 1970-01-01
      相关资源
      最近更新 更多