hi guys, the below playbook seems to work ok except when the ouput gets written to the local file, it only shows the output of one host instead of 2 that I was expecting.
What needs to change so that I can have the output for both hosts in perf.
---
- name: Get various nginx configuration information
hosts: perf
become: yes
become_user: nginx
vars:
dest_file: /root/johnc/nginx-servers/yamloutputfile.txt
tasks:
- name: Get nginx config information
shell: |
hostname
cat /etc/logrotate.d/nginx
cat /etc/logrotate.conf
ls -al /etc/cron.daily/logrotate
cat /var/lib/logrotate/logrotate.status
register: output
- name: Save the output to a local file
become: yes
become_user: root
local_action: copy content="{{ output.stdout_lines|join('\n') }}" dest="{{ dest_file }}"