-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup old Nextcloud version directories except the last four
Fixes: #80
- Loading branch information
1 parent
9fa92dd
commit 7d7035c
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
|
||
- name: Get link destination of nextcloud_symlink | ||
ansible.builtin.stat: | ||
path: "{{ nextcloud_symlink }}" | ||
register: __nextcloud_symlink | ||
|
||
- name: Find old version directories in nextcloud_workdir | ||
ansible.builtin.find: | ||
paths: "{{ nextcloud_workdir }}" | ||
file_type: directory | ||
excludes: "{{ __nextcloud_symlink.stat.lnk_target }},nextcloud-{{ nextcloud_version }}" | ||
patterns: '^nextcloud-[0-9]+\.[0-9]+\.[0-9]+$' | ||
use_regex: True | ||
register: __nextcloud_version_folders | ||
|
||
- name: "Remove old version directories except last {{ nextcloud_cleanup_versions_keep }}" | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: absent | ||
loop: "{{ (__nextcloud_version_folders | json_query('files[].path') | sort)[:-nextcloud_cleanup_versions_keep] }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters