or I want ansible to read this file
        dest: "./output/{{ inventory_hostname }}.txt"
and display on screen, without json format, just plain text

On Saturday, August 18, 2018 at 7:48:39 PM UTC+7, nbctcp wrote:
>
> I am sorry not to phrase correctly
> I want screen output actually and not file output
> So this part is correct
>     - name: copy output to file
>       copy:
>         content: "{{ output.stdout[0] }}"
>         dest: "./output/{{ inventory_hostname }}.txt"
>
>
> We need to change screen output, so that the output won;t have double 
> quote and end comma
> I think debug the one need to be modified
>     - debug: var=output.stdout_lines[0]
>
> tq
>
> On Saturday, August 18, 2018 at 6:40:53 PM UTC+7, Kai Stian Olstad wrote:
>>
>> On Saturday, 18 August 2018 04.01.48 CEST nbctcp wrote: 
>> > Hi 
>> > 
>> > I have playbook with screen output like this 
>> > 
>> >         "interface Ethernet0/0", 
>> >         " ip address 10.0.10.121 255.255.255.0", 
>> > 
>> > I want like this 
>> >         interface Ethernet0/0 
>> >          ip address 10.0.10.121 255.255.255.0 
>> > 
>> > 
>> > Basically exactly like output of this file 
>> >     - name: copy output to file 
>> >       copy: 
>> >         content: "{{ output.stdout[0] }}" 
>> >         dest: "./output/{{ inventory_hostname }}.txt" 
>>
>> The easiest is probably to use stdout_lines 
>>
>>   - name: copy output to file 
>>     copy: 
>>       content: | 
>>         {% for i in output.stdout_lines[0] %} 
>>         {{ i }} 
>>         {% endfor %} 
>>       dest: "./output/{{ inventory_hostname }}.txt" 
>>
>>
>> -- 
>> Kai Stian Olstad 
>>
>>
>>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/efa4272d-a726-4d8b-9fac-934cd1a66d44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to