【问题标题】:Ansible-Inventory AWS_EC2 plugin how to show hostnames and private ipsAnsible-Inventory AWS_EC2 插件如何显示主机名和私有 ip
【发布时间】:2020-06-10 15:27:08
【问题描述】:

是否可以使用 aws ec2 插件来模板主机名?这是我的库存脚本:

plugin: aws_ec2
keyed_groups:
  - key: tags.role
    prefix: aws
hostnames:
  - tag:Name
  - private-ip-address
groups:
    integration: group_names

运行 ansible-inventory -i integration.aws_ec2.yml --graph 给了我这个

@all:
  |--@aws_apilb:
  |  |--apilb001.core.int.ec2.corp.pvt
  |--@aws_bastion:
  |  |--core-bastion
  |  |--ops-bastion
  |  |--webint-bastion-bastion

但我想要这样的东西,其中包含私有 ip。我可以通过删除tag:Name 或保留它来获得其中一个,但我两者都想要。

@all:
  |--@aws_apilb:
  |  |--apilb001.core.int.ec2.corp.pvt (10.111.0.111)
  |--@aws_bastion:
  |  |--core-bastion  (10.111.0.112)
  |  |--ops-bastion  (10.111.0.113)
  |  |--webint-bastion-bastion  (10.111.0.113)

【问题讨论】:

    标签: amazon-ec2 ansible


    【解决方案1】:

    我怀疑目前是否有办法(ansible v2.9)来做你正在寻找的东西。但是,我可以找到一个待处理的 issue 请求类似的功能,该功能可以在 ansible v2.10 上使用。

    同时,您可以按照here 的建议覆盖现有插件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-20
      • 1970-01-01
      • 2021-01-18
      • 1970-01-01
      • 1970-01-01
      • 2020-09-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多