Skip to main content
Home
badllama.com
  • Search
  • Log In

dynamic inventory ansible ec2 aws

Iterating lists of lists using Ansible

cpeters's picture

Mon, 02/06/2017 - 05:00 by cpeters

Let's say you want to query some information for one of your instances, like the volumes associated with it:

Using the AWS CLI, you might do something like this to traverse the lists within lists:

aws ec2 describe-instances --instance-ids i-3e9217aa --query Reservations[*].Instances[*].BlockDeviceMappings[*]
.Ebs.VolumeId 

Assuming your using an Ansible dynamic inventory, you can traverse the sub-lists of your inventory like this:

Tags: 
dynamic inventory ansible ec2 aws
  • Read more about Iterating lists of lists using Ansible
Powered by Backdrop CMS