Never mind, I worked out that if I include the region (but not the 
boto_profile parameter) then it works. Not sure why it's not using the 
profile region defined in ~/.aws/config but it's not a big deal.

On Monday, 15 October 2018 17:28:52 UTC-7, Guy Knights wrote:
>
> Great, thanks! That seems to have worked.
>
> One other question related to aws_ec2 - I usually pass the AWS_PROFILE var 
> on the command line when I call ansible, eg. "AWS_PROFILE=myawsprofile 
> ./ansible-playbook -i inventory/prod/ playbooks/site.yml". However, with my 
> aws_ec2 inventory file, if I leave out the boto_profile and regions 
> variables the inventory list returns nothing. I have to explicitly include 
> these two parameters with a specific profile name and region in order for 
> it to return a list of my instances. I tried setting boto_profile: 
> 'env:AWS_PROFILE' or just 'AWS_PROFILE' (in addition to just leaving it 
> out) but it doesn't work. What am I doing wrong?
>
> Thanks again,
> Guy
>
> On Mon, 15 Oct 2018 at 17:07, flowerysong <[email protected]> wrote:
>
>> On Monday, October 15, 2018 at 7:45:15 PM UTC-4, Guy Knights wrote:
>>>
>>> Is there any way to specify a suffix for the keyed_groups option in the 
>>> aws_ec2 inventory plugin? I'm looking at migrating from Ansible 2.4 to 2.6 
>>> and would like to switch from the old ec2 dynamic inventory script. 
>>> However, we currently specify our host groups as "<server type>_servers", 
>>> eg. "web_servers". Is there any way I can replicate this host group format 
>>> in the aws_ec2 plugin or am I out of luck?
>>>
>>> I know I could change the format of our host groups but I'd prefer not 
>>> to have to do that if possible as there are conditional includes, etc I'd 
>>> have to adjust as well.
>>>
>>
>> Sure, just include the suffix in the key.
>>
>> keyed_groups:
>>   - prefix: ''
>>     separator: ''
>>     key: tags.Class ~ '_servers'
>>
>>  
>>     "all": {
>>         "children": [
>>             "aws_ec2", 
>>             "builder_servers", 
>>             "ctools_mx_servers", 
>>             "dev_servers", 
>>             "dnsbl_servers", 
>>             "egress_servers", 
>>             "jail_servers", 
>>             "master_servers", 
>>             "mx_servers", 
>>             "relay_egress_servers", 
>>             "syslog_servers", 
>>             "ungrouped"
>>         ]
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/ansible-project/Zp2FtD1hiqQ/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/2bb67f08-245e-41df-95d2-de695b47914b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/2bb67f08-245e-41df-95d2-de695b47914b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> <http://www.bluebatgames.com> 
> Guy Knights • Senior Systems Engineer
> c: 778-996-2687p: 778-379-5120
> <https://www.facebook.com/BlueBatGames/>  
> <https://www.linkedin.com/company/bluebat-games>  
> <https://twitter.com/BlueBatGames>  <http://www.bluebatgames.com>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/17b2be1a-bf6a-4a06-875d-056c021a7cef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to