简体   繁体   English

Ansible AWS 动态清单实例过滤器不起作用

[英]Ansible AWS dynamic inventory instance filters not working

I've setup Amazon's dynamic inventory for Ansible according to https://aws.amazon.com/blogs/apn/getting-started-with-ansible-and-dynamic-amazon-ec2-inventory-management/ .我已经根据https://aws.amazon.com/blogs/apn/getting-started-with-ansible-and-dynamic-amazon-ec2-inventory-management/为 Ansible 设置了亚马逊的动态库存。 I'm able to get an inventory of every EC2 instance on this account but I'd like to filter that down using tags.我可以获取此帐户上每个 EC2 实例的清单,但我想使用标签对其进行过滤。 I've set instance_filters in my ec2.ini but the script still returns the entire inventory.我在我的 ec2.ini 中设置了instance_filters ,但脚本仍然返回整个清单。

instance_filters = tag:environment=qa
ansible all -i ec2.py -m ping

I also made sure the environment variable to point to ec2.ini was set.我还确保设置了指向 ec2.ini 的环境变量。

export EC2_INI_PATH=/path/to/ec2.ini/its/different/on/my/machine/I/swear

What steps/configs am I missing that actually filters EC2 instances?我缺少哪些实际过滤 EC2 实例的步骤/配置?

The instance_filters config was working as expected. instance_filters配置按预期工作。 The problem was that the extra "hosts" I was picking up were actually ElasiCache clusters.问题是我选择的额外“主机”实际上是 ElasiCache 集群。 In order to exclude those from inventory I had to add the config below to ec2.ini.为了从库存中排除这些,我必须将以下配置添加到 ec2.ini。

elasticache = False

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM