aws ec2 add new ebs volume error

Dear all:

please help me thanks.

  • name: Create New EBS volume
    ec2_vol:
    aws_access_key: “{{ aws_access_key }}”
    aws_secret_key: “{{ aws_secret_key }}”
    instance_id: “{{ instance_id }}”
    volume_size: “{{ volume_size }}”
    device_name: “{{ device_name}}”
    region: “{{ region }}”
    volume_type: “{{ volume_type }}”
    register: ec2_vol

[WARNING]: Found variable using reserved name: name

PLAY [localhost] ************************************************************************

TASK [Create Snapshot EC2] **************************************************************
changed: [localhost]

TASK [Create New EBS volume] ************************************************************
fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Unsupported parameters for (ec2_vol) module: instance_id Supported parameters include: aws_access_key, aws_secret_key, debug_botocore_endpoint_logs, delete_on_termination, device_name, ec2_url, encrypted, id, instance, iops, kms_key_id, name, profile, region, security_token, snapshot, state, tags, validate_certs, volume_size, volume_type, zone”}

PLAY RECAP ******************************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

(ec2_vol) the module is not supported by anisble

so I need use module in add volume?

Just read the error message. It literally says what’s not right:

Unsupported parameters for (ec2_vol) module: instance_id

I’ve never used the module but from the docs you can see that this is the parameter you need to use:

https://docs.ansible.com/ansible/latest/modules/ec2_vol_module.html#parameter-instance