ec2_snapshot module - how to get snapshot id of newly created snapshot?

I am using the ec2_snapshot module to make a snapshot of a volume. In the next task, I want to use that new snapshot to create a new volume for a different server. How do I get the new snapshot volume id from the ec2_snapshot module? It errored (unsupported parameter for module: register) when I tried to use register to catch output.

`

  • name: snapshot current backup volume
    ec2_snapshot:
    aws_access_key: “{{aws_key}}”
    aws_secret_key: “{{aws_secret}}”
    region: “{{aws_region}}”
    state: present
    wait: yes
    wait_timeout: 0 #0 means Never timeout(sec)
    description: “snapshot of xvdj from backup server taken {{ansible_date_time.iso8601}}”
    instance_id: “i-a34c2437”
    device_name: “/dev/xvdj”
    snapshot_tags:
    frequency: random

`

Sounds like an indentation issue. It should be at the same level as ‘ec2_snapshot’, not the keys underneath it.

Oh, goodness. I can’t believe I missed that. It works now that I put the register statement at the correct indentation.

Thanks!