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>
7 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
7 years ago
Matt Martz
d3249e7875
pep8 fixes for contrib ( #24344 )
7 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
7 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
Khushil Dep
054e640fba
Add enumeration of block devices to ec2_block_devices
8 years ago
Ryan S. Brown
0783c172d7
Paginate DB cluster responses in AWS RDS dynamic inventory
8 years ago
Ryan S. Brown
59e499f8f0
Respect profiles & credentials for boto3 inventory
...
Using boto3 directly wasn't properly using profiles set in the `ec2.ini`
file, this change uses the `module_utils` boto3_conn instead.
8 years ago
Tom Paine
418f91d0e2
Fail softly when boto3 is not installed
...
Updated as per @ryansb comments. The EC2 inventory script will now fail
with a useful message when boto3 is not installed and the user is trying
to read RDS cluster information.
8 years ago
Tom Paine
bb5a1f7440
Add RDS cluster info to EC2 dynamic inventory
...
Add db_clusters to the ec2 inventory. Show tags. Only show clusters
matching tags in the `.ini`. Set `include_rds_clusters = True` option to
enable RDS cluster inventory collection.
Example inventory output:
```
{
"db_clusters": {
"ryansb-cluster-test": {
"AllocatedStorage": 1,
"AvailabilityZones": [
"us-west-2a",
"us-west-2b",
"us-west-2c"
],
"BackupRetentionPeriod": 1,
"DBClusterIdentifier": "ryansb-cluster-test",
"DBClusterMembers": [
{
"DBClusterParameterGroupStatus": "in-sync",
"DBInstanceIdentifier": "ryansb-test",
"IsClusterWriter": true,
"PromotionTier": 1
},
{
"DBClusterParameterGroupStatus": "in-sync",
"DBInstanceIdentifier": "ryansb-test-us-west-2b",
"IsClusterWriter": false,
"PromotionTier": 1
}
],
"DBClusterParameterGroup": "default.aurora5.6",
"DBSubnetGroup": "default",
"DatabaseName": "mydb",
"DbClusterResourceId": "cluster-OB6H7JQURFKFD4BYNHG5HSRLBA",
"Endpoint": "ryansb-cluster-test.cluster-c9ntgaejgqln.us-west-2.rds.amazonaws.com",
"Engine": "aurora",
"EngineVersion": "5.6.10a",
"MasterUsername": "admin",
"Port": 3306,
"PreferredBackupWindow": "06:09-06:39",
"PreferredMaintenanceWindow": "mon:11:22-mon:11:52",
"ReadReplicaIdentifiers": [],
"Status": "available",
"StorageEncrypted": false,
"VpcSecurityGroups": [
{
"Status": "active",
"VpcSecurityGroupId": "sg-47eaea20"
}
]
}
},
"rds": [
"ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
"ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
],
"rds_aurora": [
"ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
"ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
],
"rds_parameter_group_default_aurora5_6": [
"ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
"ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
],
"ryansb-test": [
"ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
],
"ryansb-test-us-west-2b": [
"ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
],
"type_db_r3_large": [
"ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
"ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
],
"us-west-2": [
"ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
"ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
],
"us-west-2a": [
"ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
],
"us-west-2b": [
"ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
],
"vpc_id_vpc_3ca34459": [
"ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
"ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
]
}
```
8 years ago
bqbn
3498b840c9
Fixes #16095 : Maximumly 199 filter values ( #16184 )
...
When making calls to AWS EC2 api with DescribeTags actiion and if the
number of filter values is greater than or equal to 200, it results in
400 bad request reply and the error message is:
"Error connecting to AWS backend.\n The maximum number of filter values specified on a single call is 200".
The change is so that we call get_all_tags with maximum 199 filter
values one at a time until all are consumed.
8 years ago
Adam Chainz
064ed63843
Fix ec2 inventory for potentially inconsistent data ( #12642 )
8 years ago
Victor Costan
8d3da09eae
contrib/inventory/ec2.py can read AWS credentials from ec2.ini ( #15378 )
8 years ago
Jorge Nerín
3a3e69f830
Fix substituting dots for underscores when using ips ( #15578 )
...
ec2.py was substituting the dots on ip addresses when not using hostnames like:
"ec2": [
"10_10_1_1",
now it's:
"ec2": [
"10.10.1.1",
8 years ago
Owen Tuz
3b8d753121
Avoid cache conflicts when using multiple AWS accounts
9 years ago
James Cammarata
c9da48d5ba
Merge branch 'destination_format' of https://github.com/a13m/ansible into a13m-destination_format
9 years ago
Brian Coca
e1ee2ed5a5
Merge pull request #13550 from KrzysiekJ/connect_to_region-wrap
...
Use wrapped connect_to_region everywhere in ec2.py
9 years ago