How get some word in file

21 views
Skip to first unread message

ryad9...@gmail.com

unread,
Mar 4, 2019, 11:04:10 AM3/4/19
to Ansible Project
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,


ryad9...@gmail.com

unread,
Mar 5, 2019, 5:38:04 AM3/5/19
to Ansible Project
Solved,
Reply all
Reply to author
Forward
0 new messages