Commit Graph

77 Commits (01563ccd5dfc9936397b7480f3f50531fb54edbd)

Author SHA1 Message Date
Abhijit Menon-Sen f0af07a5f4 Merge pull request #14761 from enbritely/fix-ec2-inventory
Fix AWS EC2 inventory script instance_filters read
9 years ago
Joe 21ba6e9ce8 Do not use name `tag` for intance filter 9 years ago
Joe 5975296770 Fix AWS EC2 external inventory script config read
EC2 inventory scripts reads configuration from an INI file. The `instance_filters` option controls which EC2 instances are retrieved for inventory. Filling this option and running the inventory script with Python 3 crashes with the following error:

```python
Traceback (most recent call last):
  File "./contrib/inventory/ec2.py", line 1328, in <module>
    Ec2Inventory()
  File "./contrib/inventory/ec2.py", line 163, in __init__
    self.read_settings()
  File "./contrib/inventory/ec2.py", line 393, in read_settings
    for instance_filter in config.get('ec2', 'instance_filters', '').split(','):
TypeError: get() takes 3 positional arguments but 4 were given
```

The problem is the last parameter of config.get() call, because `fallback` keyword argument is not specified.

The fix handles epmpty `instance_filers` in case of Python 2&3
9 years ago
Brian Coca 37eac4592e added back --profile to keep backwards compat
this was broken by #12548
9 years ago
Krzysztof Jurewicz 73160e65e5 Use wrapped connect_to_region everywhere in ec2.py 9 years ago
Abhijit Menon-Sen e6a9b2cae5 Add an expand_csv_tags setting to ec2.ini
If enabled, this will convert tags of the form "a,b,c" to a list and use
the results to create additional inventory groups.

This is based on PR #8676 by nickpeck (but not a straight rebase—both
the code and the nomenclature have been changed here).

Closes #8676
9 years ago
Brian Coca b2a9111b22 reversed the logic on new setting to control - replacment in groups as
it was wrong
fixes #13122
9 years ago
Matthew Jones faeccb4e61 Fix ec2 infinitely nested groups
The ec2 inventory module will incorrectly place parent groups as child
groups of themselves, this fixes that.
9 years ago
Brian Coca 2b8633cec0 Merge pull request #12855 from bcoca/ec2_inv_dash_group
make - replacement in group names optional
9 years ago
Brian Coca aac20aa076 removed unused exception vars 9 years ago
Brian Coca 07d584c0a7 make - replacement in group names optional 9 years ago
Will Thames b0133d9c8f Move connection handling failure to connect_to_aws
Make use of better error handling mechanism
9 years ago
Jameel Al-Aziz 57754b5a71 Fix security_token typo in ec2 inventory 9 years ago
Jameel Al-Aziz e7890e66f3 Combine ansible/ansible#5987 and ansible/ansible#8582
Fixes merge conflicts and standardizes option naming
9 years ago
Jeff '2 bits' Bachtel 8c11ea5666 Add an ec2 inventory option "boto_profile" that allows
the use of boto profiles for separating credentials as
specified in

http://boto.readthedocs.org/en/latest/boto_config_tut.html
9 years ago
willthames 9c967dd054 Allow ec2 inventory to use a boto profile
This allows the EC2 inventory plugin to be used with
the same configuration against different EC2 accounts

Profile can be passed using --profile variable or using
EC2_PROFILE environment variable e.g.

```
EC2_PROFILE=prod ansible-playbook -i ec2.py playbook.yml
```

Added documentation on profiles to EC2 dynamic inventory doc

Only tries to use profiles if --profile argument is given
or EC2_PROFILE is set to maintain compatibility will boto < 2.24.

Works around a minor bug in boto where if you try and use
a security token with a profile it fails (boto/boto#2100)
9 years ago
Toshio Kuratomi c1039de70c Compatibility with six-1.3.0 9 years ago
Brian Coca b8336f222d Merge pull request #11560 from oscarhealth/devel
ability to specify any combination of EC2 instance states to return
9 years ago
Brian Coca d75b4cd190 Merge pull request #11006 from alexlo03/ec2_inventory_clear_errors
explain source of EC2 inventory error
9 years ago
Andy Grimm 009d0a4bb4 Flexible tag-based naming for ec2 hosts
Introduces destination_format and destination_format_tags
to allow the construction of host names based on one or
more ec2 tags and a python format string.
9 years ago
Andrew Hamilton 7f45c9edf7 Have ec2.py expand tilde and vars when looking up the EC2_INI_PATH env variable 9 years ago
Alex Lo 7092021d81 simplify variable names 9 years ago
Alex Lo 17b94cf139 generalize error context reporting, add elasticache explanations 9 years ago
Alex Lo 610223fbf4 explain source of EC2 inventory error
https://github.com/ansible/ansible/issues/10840
before
RDS: `ERROR: Inventory script (ec2.py) had an execution error: Forbidden`
EC2: `ERROR: Inventory script (ec2.py) had an execution error: Error connecting to AWS backend.
You are not authorized to perform this operation.`
after
RDS: `ERROR: Inventory script (ec2.py) had an execution error: ERROR: "Forbidden", while: getting RDS instances`
EC2: `ERROR: Inventory script (ec2.py) had an execution error: ERROR: "Error connecting to AWS backend.
You are not authorized to perform this operation.", while: getting EC2 instances`
9 years ago
Jason Young e0a5003b27 ability to specify any combination of EC2 instance states to return 9 years ago
Carlos E. Garcia 657495d13f minor spelling changes 9 years ago
Brian Coca d0c6d2ff1c poreted log_plays, syslog_json and osx_say callbacks to v2
renamed plugins to contrib (they are not really plugins)
rewrote README.md to reflect new usage
added new dir to setup.py so it gets copied with installation, in views
of making using inventory scripts easier in teh future
9 years ago