hi all. i run a python script on a linux server that produces a report relating to
patch levels and such. it's a fairly simple thing that was requested for audit
purposes. it's a home-grown script. it works fine, and does what it needs to do.
the report it produces is simply sent to stdout.
with the hope of producing a single report covering all of these servers, i have
created a simple playbook which is designed to run the script on all targets,
capture their report via stdout, and add the reports to a single local file via
local_action. sometimes this works, and sometimes it does not. in all cases i
can see that the report is generated (stdout for each target shows on the
ansible controller during task execution). but sometimes all output for a given
target is missing from the local logfile. here is the playbook:
in case it gets munged in email:
https://paste.pound-python.org/show/Q8hdyPC38ADSYCX82wwV/
---
- hosts: all
tasks:
- name: run report
script: pkgReport.py {{ inventory_hostname }}
register: report
- name: build local report
lineinfile:
path: "/tmp/pkgReport.txt"
insertafter: EOF
line: "{{ item }}"
state: present
create: yes
with_items: "{{ report.stdout.lines }}"
delegate_to: 127.0.0.1
so first question ... can someone point out what i may be doing wrong?
and of course next question ... what is the smartest way of doing this?