I ended up going this route:
---
- hosts: "{{ host }}"
vars:
dest_dir: "/tmp/fetched"
tasks:
- name: Ensure destination directory exists
file:
dest: "{{ dest_dir }}"
state: directory
changed_when: false
- name: Fetch files from remote server
fetch:
src: "{{item.src}}"
dest: "{{item.dest}}"
flat: yes
with_items:
- {src: "/etc/security/limits.conf", dest: "{{ dest_dir }}/{{
inventory_hostname }}_limits.conf"}
- {src: "/etc/sysctl.conf", dest: "{{ dest_dir }}/{{
inventory_hostname }}_sysctl.conf"}
- {src: "/boot/grub/grub.conf", dest: "{{ dest_dir }}/{{
inventory_hostname }}_grub.conf"}
- name: Compress results
archive:
path: "{{ dest_dir }}/"
dest: "{{ dest_dir }}.tar.bz2"
format: bz2
delegate_to: localhost
notify:
- Email results
- Cleanup local files
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ab8ce66c-5ebf-4cb0-83dd-dd671baeb4fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.