How to identify the hard drive with the OS installed using ansible?

the rootfs is gathered in ansible facts and does not need to be "extracted" via shell.

here's how to access it:

# cat play.yml
---
- name: display rootfs partition
  hosts: all
  become: yes
  gather_facts: yes

  tasks:
   - name: print root partition
     shell: echo "{{ ansible_cmdline.root }}" > /tmp/rootfs_part
# ansible-playbook play.yml -i localhost,

PLAY [display rootfs partition] ******************************************************************************************************************************************************************************

TASK [print root partition] **********************************************************************************************************************************************************************************
changed: [localhost]

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

# cat /tmp/rootfs_part
/dev/mapper/mirror-root