How to force EBS volume to detached from EC2? ec2_vol is not working.

I am trying to detach EBS volume:

— # Ansible role to detach EBS Volume
- name: Detach AWS EBS Volume
ec2_vol:
aws_access_key: ‘{{ AwsAccesskey }}’
aws_secret_key: ‘{{ AwsSecretkey }}’
region: ‘{{ region }}’
id: ‘{{ item }}’
instance: None
with_items: “{{ awsebsid }}”

It is not able to detach EBS volume if it is mounted. Please, can you suggest how to force or detach EBS volume? I understand it is best practice to unmount the volume from OS before detaching but is it compulsory?