-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
archive exclude_path can't exclude directories below 2nd level #6857
Comments
Files identified in the description: If these files are incorrect, please update the |
Files identified in the description: If these files are incorrect, please update the |
how about this? - name: Create backup of files/directories - TEST
community.general.archive:
path:
- "/home/user/foldertobackup/*"
- "/home/user/foldertobackup/subdir3/*"
dest: "/home/user/backup/myarchive.gz"
format: gz
mode: 0644
exclude_path:
- "/home/user/foldertobackup/log"
- "/home/user/foldertobackup/sql"
# avoid walking the whole path again and reinclude the mentioned subdirectory and its contents
- "/home/user/foldertobackup/subdir3"
- "/home/user/foldertobackup/subdir3/subsubdir4"
|
Yes like that it actually works, thanks! I think I have finally wrapped my head around it -> adding the BUT to be honest, this is not really the most intuitive way of specifying exclusion paths IMHO! Here is the output of my test in case anyone is interested:
EDIT: see #593 (comment) for a working example using |
Summary
When running archive, it is not possible to exclude a directory or files that are below the 2nd level of hierarchy
Backup path
/home/user/foldertobackup/*
I want to exclude the folder (and its contents):
/home/user/foldertobackup/subdir3/subsubdir4
Issue Type
Bug Report
Component Name
plugins/modules/archive.py
Ansible Version
Community.general Version
Configuration
$ ansible-config dump --only-changed
OS / Environment
Mac OS and Debian Bullseye tested
Steps to Reproduce
Expected Results
The archive should not contain the folder or any files in it:
/home/user/foldertobackup/subdir3/subsubdir4
Actual Results
Archive contains the folder (among others)
/home/user/foldertobackup/subdir3/subsubdir4
Code of Conduct
The text was updated successfully, but these errors were encountered: