On Friday, 13 April 2018 10.11.21 CEST
smitconsu...@gmail.com wrote:
> Thanks. It is creating file for each hostname but data is not in readable
> format. Are you able to do favor little more, how to get the data in each
> file as orignal form like as processes list show on linux machine?
Replace {{ output }} with {{ output.stdout }}
> I was
> initially thinking to get output from all hosts in one file and somehow get
> processes list along with hostname one by one. But this can work as well.
To do that you need to use jinja template, something like this should work.
- name: Getting some details of systems
copy:
content: |
{% for i in ansible_play_hosts %}
Output for host {{ i }}:
{{ hostvars[i].output.stdout }}
{% endfor %}
dest: /my/file
delegate: localhost
--
Kai Stian Olstad