https://github.com/ccdc-opensource/ansible-role-compact-vm-image
https://github.com/ccdc-opensource/ansible-role-compact-vm-image
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ccdc-opensource/ansible-role-compact-vm-image
- Owner: ccdc-opensource
- License: mit
- Created: 2022-08-09T14:58:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-10-31T14:25:13.000Z (4 months ago)
- Last Synced: 2025-10-31T16:06:57.114Z (4 months ago)
- Size: 95.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# ccdc.compact-vm-image
[](https://galaxy.ansible.com/ccdc/compact_vm_image/)
[](https://github.com/ccdc-opensource/ansible-role-compact-vm-image/actions/workflows/lint-ansible-role.yml)
[](https://github.com/ccdc-opensource/ansible-role-compact-vm-image/actions/workflows/common_ccdc_status_checks.yml)
An Ansible role to compact a target machine's disk for export as a virtual machine image.
## What does this role do?
- [Windows] Clean WinSXS folder and remove package files for uninstalled features
- [Windows] Remove temporary files
- [Windows] Download+Run+Delete UltraDefrag on all hard drives
- [Windows] zero free space using SDelete on all hard drives
## Requirements
This role requires the `[community.windows](https://galaxy.ansible.com/community/windows)` collection.
## Role Variables
| Variable | Default | Comments |
|-------------------|-----------|--------------------------------------------------------------------|
| `remove_packages` | `true` | Whether to remove package files for uninstalled features (Windows) |
| `temporary_files` | see below | A list of directories to clear out. |
### Default value for `temporary_files`
```yaml
temporary_files:
- "{{ ansible_env.LOCALAPPDATA }}\\Temp\\*"
- "{{ ansible_env.SystemRoot }}\\Temp\\*"
- "{{ ansible_env.SystemRoot }}\\Logs\\*"
- "{{ ansible_env.SystemRoot }}\\Panther\\*"
- "{{ ansible_env.SystemRoot }}\\WinSxS\\ManifestCache\\*"
- "{{ ansible_env.SystemRoot }}\\SoftwareDistribution\\Download"
```