Get indice in file if caracter present

19 views
Skip to first unread message

ryad9...@gmail.com

unread,
Feb 27, 2019, 11:35:40 AM2/27/19
to Ansible Project
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 :/


Thank you very much !! ;)


ryad9...@gmail.com

unread,
Feb 28, 2019, 3:19:07 AM2/28/19
to Ansible Project
Uppp pleasee !!!

Jean-Yves LENHOF

unread,
Mar 1, 2019, 6:03:02 PM3/1/19
to ansible...@googlegroups.com

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

Regards,

JYL

Reply all
Reply to author
Forward
0 new messages