EC2 volume_size not working

Hello all,

I’m trying to create an EC2 on my AWS account using Ansible (ansible-playbook 2.0.2.0), and i have an issue modifying the root volume of the EC2, when i add the following parameters:

volumes:

  • device_name: /dev/xvda
    volume_size: 30
    device_type: gp2
    delete_on_termination: true

tasks:

  • name: Launch instance
    ec2:
    state: present
    vpc_subnet_id: “{{ vpc_subnet }}”
    region: “{{ region }}”
    instance_type: “{{ instance_type }}”
    image: “{{ image }}”
    volumes: “{{ volumes }}”
    wait: true
    instance_tags:
    env: “{{ prefix }}”
    count_tag: “env”
    exact_count: 1
    assign_public_ip: yes
    register: ec2

I received the following error:

encrypted=volume.get(‘encrypted’, None))\nTypeError: init() got an unexpected keyword argument ‘encrypted’

Removing the “volumes” block and everithing works fine.

I’m stuck with that error and i don’t have any idea on how to solve it, any help will be appreciate.

thanks for your support