I have a task that will save outputs to a local file, when I check the text 
file the contents are missing .
 ex: I have 13 inventory host  and should run each task and save the output 
to local file. so ideally should have all 13 results in each file. 

I tried serial fork but nothing helped. can someone plz assist. 

$ cat 1txt |grep IP |wc -l
13
$ cat 2.txt |grep IP |wc -l
12
$ cat 3.txt |grep IP |wc -l
13
$ cat  4.txt |grep IP |wc -l
12
$ cat 5.txt |grep IP |wc -l
12
$ cat 6.txt |grep IP |wc -l
13

- name: save output to a file
   connection: local
   lineinfile:
     line: "IP is {{ inventory_hostname.split() | list | to_yaml }} {{ 
result | list | to_yaml }}"
     dest: /tmp/user.txt
     create: yes
     insertafter: EOF
     state: present
   delegate_to: localhost

I tried copy module but the output saved only last output . that's the 
reason opted for lineinfile.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fd1f9c8b-3ff4-4f11-be08-1d09b49d23cdn%40googlegroups.com.

Reply via email to