In ansible version 2.9.25 - how to create tar file of given dir and also compress (gzip) that dir in Linux (RHEL 7.9) to the given destination path directly. During Oracle DB patching as pre-check task, I want to take backup of existing oraInventory dir to the destination path. oraInventory is always under /u01/app dir in all Linux servers. I have already tried the community.general.archive but it is not working properly in "ansible version 2.9.25".
at present - Manually I used to run below command which creates tar file of oraInventory and gzip to the destination path (/dbbackup)
cd /u01/app tar -pczvf /dbbackup/Backup_OraInv_<SID_NAME>.tar oraInventory | gzip > /dbbackup/Backup_OraInv_<SID_NAME>.tar.gz
Please help for this code.
I have already tried the community.general.archive but it is not working properly in "ansible version 2.9.25".
According the documentation archive
module – Creates a compressed archive of one or more files or trees and Examples, a minimal playbook
---
- hosts: localhost
become: false
gather_facts: false
tasks:
- archive:
path: "/home/user/test/toarchive/"
dest: "backup.tar.gz"
format: gz
force_archive: true
will result into a backup.tar.gz
file having the requested content
tar -tvf backup.tar.gz
To summarize, based on the currently given information not able to (re-)produce an issue.