Get indice in file if caracter present

Hy all,

I have one file with this content:

1,user1,host1,appli1
2,user2,host2,appli2

My problem is that i want an task who look if {{ ansible_user}},{{inventory_hostname}} == “user1,host1”

He must return ID of this line “1”

If {{ ansible_user}},{{inventory_hostname}} == “user2,host2” He must return “2”

How do it please ??

I test command lookup et lineinfile but it’s not works :confused:

Thank you very much !! :wink:

Uppp pleasee !!!

Please explain what you want to achieve, not the way you want to code

Regards,

JYL