# How get some word in file

**URL:** <https://forum.ansible.com/t/how-get-some-word-in-file/29819>\
**Category:** Ansible Project\
**Created:** [March 4, 2019, 4:04pm UTC](https://forum.ansible.com/t/how-get-some-word-in-file/29819 "2019-03-04T16:04:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryad9200000](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ryad9200000](https://forum.ansible.com/u/ryad9200000)\
**Post date:** [March 4, 2019, 4:04pm UTC](https://forum.ansible.com/t/how-get-some-word-in-file/29819/1 "2019-03-04T16:04:10Z")

</div>

Hy all,

I’m sorry i ask a lot of question but it’s my last question.

I have this file :

2,user2,hostname2,appli1  
1,user1,hostname1, **appli1,appli2,appli3** , …  
3,user3,hostname3,appli1

**appli1** it’s one application for install on host **hostname1** with user **user1**  
Back appli1 there is other file appli1.pub with something word…

I have this task :

- name: Inser all appli in authorized\_key  
blockinfile:  
block: “{{ lookup(‘file’, ‘{{ role\_path }}/test\_appli/{{ nom\_appli }}.pub’) }}”  
dest: ‘/home/{{ nv\_user }}/.ssh/authorized\_keys.test’  
marker: “#CLE APPLICATIVE {{nom\_appli}} DE {{ nv\_user }}@{{ nv\_host }}”  
vars:  
nom\_appli: “{{ lookup(‘csvfile’, ‘{{ item }} file=clef\_applicatives.csv delimiter=, col=3’) }}”  
with\_items: “{{ indice }}”  
when: ansible\_user and inventory\_hostname in my\_file

I want one task who see all name appli and who inser with blockinfile in other file.

Thank you

Regards,

---

<div class="post-metadata">

**Author:** ![ryad9200000](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ryad9200000](https://forum.ansible.com/u/ryad9200000)\
**Post date:** [March 5, 2019, 10:38am UTC](https://forum.ansible.com/t/how-get-some-word-in-file/29819/2 "2019-03-05T10:38:04Z")

</div>

Solved,
