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

99 views
Skip to first unread message

Joanna Delaporte

unread,
Jul 14, 2016, 2:53:30 PM7/14/16
to Ansible Project
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


Scott Sturdivant

unread,
Jul 14, 2016, 3:01:39 PM7/14/16
to Ansible Project
Sounds like an indentation issue.  It should be at the same level as 'ec2_snapshot', not the keys underneath it.

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7063acaf-d0b6-462a-aa64-9380e7b7b277%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joanna Delaporte

unread,
Jul 14, 2016, 3:46:02 PM7/14/16
to Ansible Project
Oh, goodness. I can't believe I missed that. It works now that I put the register statement at the correct indentation.

Thanks!
Reply all
Reply to author
Forward
0 new messages