Extract a single item from a list using regex in Ansible

Solution 1:

Hmm, if you need to get interface name, try:

- debug:
    msg: "{{ ansible_interfaces | select('match','ens.*') | list | first }}"