Variable value saving into one column of csv file

Hi,

I want to save 1st variable value coming from loop into 1st column and 2nd variable value coming from loop into 2nd column and so on.

  • local_action: lineinfile line=“{{ result.results[item|int].container.Config.Hostname }}” dest=/tmp/abhay.csv

with_sequence: start=0 end=“{{ count|int }}”

  • local_action: lineinfile line=“{{ result.results[item|int].container.State.Status }}” dest=/tmp/abhay.csv

with_sequence: start=0 end=“{{ count|int }}”

Result should be like below

var1.value1 var2.value1
var1.value2 var2.value2
var1.value3 var2.value3

How to achieve this.

Hi,

I want to save 1st variable value coming from loop into 1st column and 2nd variable value coming from loop into 2nd
column and so on.

- local_action: lineinfile line="{{ result.results[item|int].container.Config.Hostname }}" dest=/tmp/abhay.csv
with_sequence: start=0 end="{{ count|int }}"

- local_action: lineinfile line="{{ result.results[item|int].container.State.Status }}" dest=/tmp/abhay.csv
with_sequence: start=0 end="{{ count|int }}"

Result should be like below

var1.value1 var2.value1
var1.value2 var2.value2
var1.value3 var2.value3

How to achieve this.

I would suggest to use a template instead of lineinfile.

Regards
          Racke

Can you please provide me any example.