Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2 inventory plugin: add support for a jmesquery query filter #232

Closed
goneri opened this issue Jan 11, 2021 · 5 comments
Closed

ec2 inventory plugin: add support for a jmesquery query filter #232

goneri opened this issue Jan 11, 2021 · 5 comments
Assignees
Labels
feature This issue/PR relates to a feature request

Comments

@goneri
Copy link
Member

goneri commented Jan 11, 2021

SUMMARY

It's possible to pass a jmespath filter describe_instances through the query parameter.
At this stage, this is an investigation and one of the problem I see is that we don't want to break the consistency the final JSON structure.
See: #186

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
  • aws_ec2 inventory
@goneri goneri self-assigned this Jan 12, 2021
@ansibullbot
Copy link

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added the feature This issue/PR relates to a feature request label Jan 13, 2021
@goneri
Copy link
Member Author

goneri commented Jan 14, 2021

The jmespath filtering of the aws client is done on the local side. The AWS API don't support any server side filtering. In addition jmespath transfort the format of the final structure. So this is not something we can use at our level.

@chrismeyersfsu
Copy link
Contributor

Thanks for diving deep into this! Client side filtering .. booo. So that I understand, the current and based filtering is happening server-side or client side?

@tremble
Copy link
Contributor

tremble commented Jan 18, 2021

Short version is, what's done today is done server-side.

The key line is:
https://github.com/ansible-collections/amazon.aws/blob/main/plugins/inventory/aws_ec2.py#L428

There's a little bit of magic goes into generating the filters, but what's being called is ultimately https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances with the Filters parameter which is painfully limited (not all AWS services even support server side filtering :( ).

@goneri
Copy link
Member Author

goneri commented Apr 13, 2021

I close this since we don't plan to go any further. #328 gives a better solution to address the problem.

@goneri goneri closed this as completed Apr 13, 2021
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
* Fully support mixed instance policy

Previously, setting instances_distribution was not supported.
instances_distribution should be supported, to allow users to enable
spot instances within their mixed instance ASGs.

Note: The type and significance of the mixed_instance_policy has
changed. It now captures all of the mixed_instance_policy configuration
parameters, rather than just a list of instance types.

Fixes ansible-collections#231

* Restore mixed_instances_policy backwards-compat

Restore mixed_instances_policy backwards compatibility by using
mixed_instances_policy_full to return full dictionary.

Also, fix some doc typos, add CHANGELOG fragment, and split into
separate test case.

Addresses feedback in ansible-collections#232

* Only return mixed_instances_policy_full if set
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
* Fully support mixed instance policy

Previously, setting instances_distribution was not supported.
instances_distribution should be supported, to allow users to enable
spot instances within their mixed instance ASGs.

Note: The type and significance of the mixed_instance_policy has
changed. It now captures all of the mixed_instance_policy configuration
parameters, rather than just a list of instance types.

Fixes ansible-collections#231

* Restore mixed_instances_policy backwards-compat

Restore mixed_instances_policy backwards compatibility by using
mixed_instances_policy_full to return full dictionary.

Also, fix some doc typos, add CHANGELOG fragment, and split into
separate test case.

Addresses feedback in ansible-collections#232

* Only return mixed_instances_policy_full if set
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
* Fully support mixed instance policy

Previously, setting instances_distribution was not supported.
instances_distribution should be supported, to allow users to enable
spot instances within their mixed instance ASGs.

Note: The type and significance of the mixed_instance_policy has
changed. It now captures all of the mixed_instance_policy configuration
parameters, rather than just a list of instance types.

Fixes ansible-collections#231

* Restore mixed_instances_policy backwards-compat

Restore mixed_instances_policy backwards compatibility by using
mixed_instances_policy_full to return full dictionary.

Also, fix some doc typos, add CHANGELOG fragment, and split into
separate test case.

Addresses feedback in ansible-collections#232

* Only return mixed_instances_policy_full if set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request
Projects
None yet
Development

No branches or pull requests

4 participants