Hi@akhtar,
We can create a volume docker resource using the docker_volume module. This module is available in Ansible 2.4 or higher version. You can see the below playbook. It may help you.
vars:
docker_volume: db_data
- name: "Create a Volume"
docker_volume:
name: "{{ docker_volume }}"