- 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-a34c2967" device_name: "/dev/xvdj" snapshot_tags: frequency: random client: jdelaporte Name: "backups_{{ansible_date_time.iso8601}}" register: new_snapshot
- name: get instance id for current nfsmaster ec2_remote_facts: aws_access_key: "{{aws_key}}" aws_secret_key: "{{aws_secret}}" region: "{{aws_region}}" filters: ip-address: 52.34.225.188 register: nfsmaster_info
- name: create new volume from new backup data snapshot
ec2_vol:
aws_access_key: "{{aws_key}}"
aws_secret_key: "{{aws_secret}}"
region: "{{aws_region}}"
state: present
device_name: /dev/xvdz
volume_size: 700
snapshot: "{{new_snapshot.snapshot_id}}"
instance: "{{item.id}}"
volume_type: standard
with_items: "{{nfsmaster_info.instances}}"
failed: [localhost] ...
"msg": "Cannot specify volume_size together with id or snapshot"