-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Allow ec2 inventory to use a boto profile #5987
Conversation
This is great, as it is using Boto to handle multiple AWS accounts. I prefer this over #5156 to accomplish the same goal. @willthames Can you add one |
@willthames I'd also suggest adding support for setting the profile via an environment variable (similar to the EC2_INI_PATH environment variable). This would allow you to use ec2.py directly as your inventory script. I know there was talk about allowing inventory scripts to accept arguments, but I do not believe this has been implemented yet (or has it?). |
@willthames please post an example usage of ansible-playbook with this patch per @pas256's suggestion. |
@willthames unfortunately i don't think quoting the script and the param is going to work for the case where users have a mix of scripts and ini files in a directory and then pass the dirname to -i ... Have you tried testing that? |
@jctanner - no, that almost certainly won't and shouldn't work! If you're using Multiple Inventory sources (cool feature btw, wasn't aware of it until your comment prompted me to look into it) then you should probably use the environment variable as you won't be calling a specific script. Glad I just fixed it to allow environment variable! |
Note when merging/testing we need to indicate in the docs that those options are only available in 1.6. |
@willthames do you want to take a look at fixing the merge conflicts so we can test and merge this? |
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) Allow inventory scripts to take additional arguments - e.g. ``` ansible-playbook -i 'ec2.py --profile prod' playbook.yml ```
@jctanner - merge conflicts fixed. |
@jctanner can the needs_revision label be removed please? |
Hi Will, James unfortunately does not work for us any longer, but you are correct in that we are no longer waiting for edits on this one. Thank you! |
I was going to ask for a rebase, but as others have mentioned before in the ticket, could you change this from being a command line switch to an environment variable? |
@bcoca as documented, it already takes an environment variable as an alternative to the command line parameter. |
@willthames sorry, I was unclear, can you just drop the command line switch? in any case this needs a rebase, but as @jalaziz mentions he has an overlapping PR should I close this in favor of that one? |
OK, closing this ticket then as discussed above. |
Fixes merge conflicts and standardizes option naming
…e7890e66f3ec9224f01871ee0e7268e581c74ae6
Issue Type:
Feature Pull Request
Ansible Version:
Based on:
ansible 1.5 (devel 6f405c8) last updated 2014/02/13 18:12:39 (GMT +1000)
Environment:
N/A
Summary:
This allows the EC2 inventory plugin to be used with
the same configuration against different EC2 accounts
Added documentation on profiles to EC2 dynamic inventory doc
Only tries to use profiles if --profile argument is given
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)