---

- name: "Install LVM2"
  become: yes
  yum:
    name: lvm2
    state: present

- name: "Test if physical volume is present"
  become: yes
  shell: "pvdisplay {{ dm_device }}"
  ignore_errors: true
  register: pv_exist


---

- name: "devicemapper: Install LVM2"
  become: yes
  yum:
    name: lvm2
    state: present

- name: "devicemapper: Create volume group"
  become: yes
  lvg:
    vg: docker
    pvs: "{{ dm_device }}"
    state: present

Use lvg module, no need to create physical volume
Use lvg module, no need to create physical volume
