Dear all:
I have some problem I don’t know I attach ebs from snapshot but attach show error message please help thanks.
fatal: [localhost]: FAILED! => {
“msg”: “The task includes an option with an undefined variable. The error was: list object has no element 0\n\nThe error appears to be in ‘/home/sandy/aws/create-EBS.yml’: line 74, column 6, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: attach ebs volume from snapshot\n ^ here\n”
- name: Get snapshot info
ec2_snapshot_info:
aws_access_key: “{{aws_access_key}}”
aws_secret_key: “{{aws_secret_key}}”
region: “{{ region }}”
filters:
“tag:Name”: snapshot
register: ec2_snapshot_facts
"this error
- name: attach ebs volume from snapshot
ec2_vol:
aws_access_key: “{{ aws_access_key }}”
aws_secret_key: “{{ aws_secret_key }}”
region: “{{ region }}”
zone: “{{zone}}”
instance: “{{ instance_id }}”
device_name: “{{ device_name }}”
snapshot_ids: ‘{{ec2_snapshot_facts.snapshots[0].snapshot_id}}’
with_items: “{{instance_id}}”