Commit Graph

93 Commits (fbee506284ee9efcbb3aaa9575aa284a58c744bd)

Author SHA1 Message Date
Sam Doran 3cd98a9fcc Use ansible.module_utils.six in inventory scripts (#55000)
* Use six from ansible.module_utils for inventory scripts

Remove skips from sanity test

* Change all imports of ConfigParser to use module_utils.six.moves

* Remove commented out lines

* Fix six imports
6 years ago
Stef Fen 9dc36fcaf0 Fix AWS STS session detection (#49536)
If CLI has already assumed a IAM Role, then the cli environment has an additional variable: AWS_SESSION_TOKEN
This needs to be forwarded to boto to successfully reuse the AWS session in boto.
6 years ago
Simon Wydooghe 505ce6ccf6 ec2 inventory: python 3.7 compatibility (#43716)
ec2 inventory script was throwing errors when using Python 3.7:

TypeError: option values must be strings

This changes the None ConfigParser options to empty strings instead.
6 years ago
Max Cameron cf1006179d Fixes ec2.py assume_role. (#37357)
* Fixes ec2.py assume_role

Previously when connect_to_aws was called it updated the credentials in place.  "connect_to_aws" is called multiple times: on the second run it tries to assume the same role it is already using, and potentially failing depending on your iam policies.
6 years ago
Matt Martz c1c229c6d4
Remove use of simplejson throughout code base (#43548)
* Remove use of simplejson throughout code base. Fixes #42761

* Address failing tests

* Remove simplejson from contrib and other outlying files

* Add changelog fragment for simplejson removal
6 years ago
rubal033 61c6f4fda1 Fixes #40661 fixed elasticache inventory node limit issue. (#40674)
* fixed elasticache inventory node limit issue

* fixed elasticache inventory node limit issue, sanity fixes

* fixed elasticache inventory node limit issue, sanity fixes

* fixed elasticache inventory node limit issue, spelling corrections

* fixed elasticache inventory node limit issue, removed blank lines
7 years ago
Daryl Banttari e0893aacc5 [ec2 contrib script] Add ability to filter EC2 instances via shell environment (#39034) 7 years ago
Javier Beaumont 8faf9837d0 [cloud][aws] PEP8 renaming in EC2 dynamic inventory (#39164) 7 years ago
Jonathan McCall cdf8f29e70 Add hash making inventory caches unique to inventory script ran (#34742) 7 years ago
Robert "Bo" Davis b5c0141fb0 Use hostname in group_by_aws_account to prevent duplicates. (#34053)
Fix typo. The use of `dest` for group_by_aws_account causes the group to be produced using IP and to duplicate the hosts in the inventory.

Fixes #23772

Signed-off-by: bo <robert@jbanetwork.com>
7 years ago
Ryan MacLean d7ca068c3f [cloud] Typo fixes for ec2 dynamic inventory (#32957) 7 years ago
Matt Clay e45c763b64 Fix invalid string escape sequences. 7 years ago
Kenny Woodson c4af03118b Add support for tags and instance attributes for destination variable for the ec2 dynamic inventory. (#29033) 7 years ago
Avner Cohen d313c2d5e9 [cloud] RDS config should be getboolean, as per ec2.ini instructions (#31168) 7 years ago
Jiri Tyr d35ef1fc21 [cloud][contrib] Set missing default values for EC2 inventory (#28375)
* Set missing default values for EC2 inventory

* Make it run even with no ec2.ini file

* Fixing INI file reading

* Refactor how defaults are handeled

Define defaults in a dictionary and use .get rather than if statements with has_option

* Removing double keys and fixing logic for instance_filter

* Removing one more doubled key
7 years ago
Martin Krizek d804ac6f4b Implement AND'd filters in ec2.py/ini (#30272)
* Implement AND'd filters in ec2.py/ini

remove debug print

* Adjusting code to changed filters' data structure
7 years ago
jchristi 9d5671db76 Allow filtering RDS instances by tags in the ec2 dynamic inventory script (#24423)
* Allow filtering RDS instances by tags in the ec2.py dynamic inventory script

* PEP8 fix

* Fix no-bastring code smell

* Simplify logic in ec2.py RDS filtering by tag
7 years ago
Sebastian Cruz 223f94ec56 Fix missing option in #27848 (#27892) 7 years ago
Sebastian Cruz ce5e4dfc38 Add option to group ec2 instances by platform. (#27848)
All credits to https://github.com/felipecvo

See PR: https://github.com/ansible/ansible/pull/14246
7 years ago
Adam Johnson 3f85aa3abd Use a real list comprehension rather than list() around a generator (#25594)
It's faster and more idiomatic.
7 years ago
Tian You 9364fa202f [cloud] Group RDS instances by tag keys in ec2 dynamic inventory (#24763) 7 years ago
Josh Smift 290d84f904 Update ansible_ssh_host->ansible_host in ec2.py dynamic inventory (#17113) 7 years ago
Brian Coca 365f3dc9d9 switched to elif 7 years ago
Lorin Hochstein b17da1fae9 ec2.py: Better error messages for OptInRequired
Improve error messages for RDS and ElastiCache failures for code OptInRequired.
7 years ago
Abhijeet Kasurde b89cb95609 Fix spelling mistakes (comments only) (#25564)
Original Author : klemens <ka7@github.com>

Taking over previous PR as per
https://github.com/ansible/ansible/pull/23644#issuecomment-307334525

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
8 years ago
Sloane Hertel e67cdd448e [cloud] EC2 dynamic inventory default filename is documented as ec2.ini - fixes #24396 (#24515)
* the default filename is ec2.ini

(to override that use the env var EC2_INI_PATH)

* allow fallback to ec2.ini
8 years ago
Matt Martz d3249e7875 pep8 fixes for contrib (#24344) 8 years ago
Elijah Lynn c7ae6b9fd5 [cloud][inventory] Get tags for RDS instances. (#23989)
* Get tags for RDS instances.

Boto3 only at this time.

Relates to #11569, #14464.

* Add a check for boto3

* Fix HAS_BOTO3 error
8 years ago
Toshio Kuratomi 6bad4e57bd Migrate most uses of if type() to if isinstance()
Also convert those checks to use abcs instead of dict and list.

Make a sentinel class for strategies to report when they've reache the end
8 years ago
Steve Kuznetsov 6318229bc4 Only read EC2 `regions_exclude` list if necessary (#18720)
When specifying a literal whitelist of AWS EC2 regions in the dynamic
inventory configuration file, it should not be necessary to also include
a literal blacklist, especially as the blacklist is not honored in this
case anyway. By reading the literal blacklist only when necessary, it is
possible for a user to provide a more minimal EC2 configuration file.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
8 years ago
Rune T. Sorensen 6804d69557 [cloud][contrib] IAM role support for EC2 dynamic inventory (#15196)
* EC2 inventory can now connect using an IAM role

* Fix comment indentation

* Make sure that Ec2Inventory.iam_role is always defined

* Add missing import
8 years ago
William Holroyd 4ca7726e75 Fix Elasticcache issue where ec2 script would fail on finding lack of primary endpoint address on Redis cluster (#20190) 8 years ago
Alex Trevino 0d060a185f Allow ec2.py to be imported (#21637) 8 years ago
rafstef 8acb6417cb [cloud][inventory] Let ec2.py be renamed and search for a matching .ini file (#21567)
With this proposed PR, we want to make the use of many ec2 dynamic inventory files more flexible.
We are using multiple AWS accounts. We want to use different ini file (one for every account) and only one ec2.py.
8 years ago
Ryan S. Brown 3c25a39b3e [cloud][aws] Use binary read for inventory cache file 8 years ago
Alex Trevino 413dfa7273 [cloud][aws] Use `with` statement for file rw in EC2 dynamic inventory (#21390)
* Use with statement when doing rw on files

* Deserialize file-like object directly instead of a string

For python 2/3 compatibility reasons, per PR feedback.
8 years ago
Jonathan McCall 047ed2728c Pass boto_profile to get_route53_records (#14354)
* Pass boto_profile to get_route53_records

* Add conditional around r53_conn to check for boto_profile
8 years ago
Ian White 80bc7048bd Feature: adding route53_hostnames option to set the hostnames from route 53 (#20909)
* adding route53_hostnames option to set the hostnames from route 53

* checking whether the route53_hostnames option is present as suggested by @s-hertel

* setting route53_hostnames to None when config option not present

* skip the to_safe only when using route53_hostnames option, as suggested by @ryansb

* skipping the to_safe strip only for the hostnames that came from route53 as suggested by @ryansb
8 years ago
gregorydulin cf424f0413 [cloud] Add group_by_instance_state to EC2 Dynamic Inventory (#20430) 8 years ago
Ilya Kalinin 259b05dd8e [cloud] Add stack_filters option to EC2 inventory script 8 years ago
Matt Martz 5942de603d Legacy pep8 clean fixes for contrib and hacking (#21081) 8 years ago
Matt Clay e401b4e424 PEP 8 fix. 8 years ago
Naoya Nakazawa 31db1bcd34 ec2.py support region auto (#15427) 8 years ago
Will Thames d6ea400efb Improve boto profile handling for EC2 inventory (#20280)
Ensure command line profile argument and AWS_PROFILE environment variable
overrides config file
Remove unnecessary `lambda` function
Fix cache file path construction to be more pythonic (and windows-ready)
8 years ago
Matt Clay cb76200c7d PEP 8 E111 & E114 cleanup. (#20838) 8 years ago
Matt Clay d0d1158c5e PEP 8 cleanup. (#20789)
* PEP 8 E703 cleanup.
* PEP 8 E701 cleanup.
* PEP 8 E711 cleanup.
* PEP 8 W191 and E101 cleanup.
8 years ago
Matthew Wedgwood 3ab388f6dd Add account ID grouping and attribute to ease multi-account management 8 years ago
Carlos E. Garcia 0b8011436d minor spelling changes 8 years ago
Tony Kinsley 73da2663a3 Resolves #18312 python3 support for ec2.py 8 years ago
Khushil Dep 08db04ccb6
Changes as per @abadger 8 years ago