I'm trying to avoid a list of 'command' modules in my ansible play, but there seems to be a void of ansible docs regarding tar/gz and the synch module seems... incomplete.
I'd like to gzip a tarball of a big directory then rsync it to another host. Even using 'command' seems to not work for me :<
"warnings": ["Consider using unarchive module rather than running tar"]}
[WARNING]: Consider using unarchive module rather than running tar
PLAY RECAP *********************************************************************
ctarlctarl : ok=2 changed=0 unreachable=0 failed=1
The 'unarchive' module seems to expect an already compressed/archived directory and doesn't appear to be the solution I want.
Related but unanswered: ansible playbook unable to continue as the `tar` fails due to `file change as we read`
(Edit) showing the task since it was asked if I remembered the z. =)
- name: tar ball app dir, exclude conf files
command: "tar -zcvf {{ item.code_dir }}.tar.gz --exclude '*config*' ."
args:
chdir: "{{ apps_home }}/{{ item.code_dir }}"
with_items:
- "{{ processes }}"