Hi All,
I am using Line in file nodule to write a list output in ansible to a file in the target machine.
Below is the code i have used.
hosts: localhost
tasks:
- lineinfile:
create: yes
regexp: "NONEXISTENTLINE"
dest: /projects/testing/check.txt
line : "{{item}}"
state: present
with_items:
- "{{something}}"
And that something is a list and its value is given below,
["WOAprofile1",
"WOAprofile2",
"WOAprofile3"]
When I am using the above line in file prints each value of the list in separate line.
But I need the output in the file as below,
WOAprofile1, WOAprofile2, WOAprofile3
Note: the number of lines in the variable "something" will be differ from server to server.