According to the ec2_vol module source code, the module returns:
volume_id
device
In your case, you are creating multiple volumes via with_items, so the ec2_volumes
variable that you register will be a dictionary with a key named results
that holds the list of results from each of the individual ec2_vol invocations.
Here's an example that prints out the volume ids (warning: I haven't tested this).
- name: Attach a volume to previously created instances
local_action: ec2_vol instance={{item.id}} volume_size=5 aws_access_key={{aa_key}} aws_secret_key={{as_key}} region={{region}}
with_items: ec2.instances
register: ec2_volumes
- name: Print out the volume ids
debug: msg={{ item.volume_id }}
with_items: ec2_volumes.results