Uncompress collection for ansible. Lets you download an uncompress .gz and .bz2 files which currently isn't possible with the unarchive built-in module. https://galaxy.ansible.com/ui/repo/published/compscidr/uncompress/
Motivated by the push-back against .gz .bz2 not being supported for compressed files: ansible/ansible-modules-core#3241 (comment)
and the existance of this project: https://github.com/vadikgo/uncompress.
Updating the existing project to support installation via a meta/requirements.yml
file and then submitting to ansible galaxy so that it can be found and installed
easily.
ansible-galaxy collection install compscidr.uncompress
Add the following to requirements.yml
collections:
- name: compscidr.uncompress
Then run
ansible-galaxy install -r requirements.yml
Add the following to your requirements.yml file:
collections:
- name: git+https://github.com/compscidr/ansible-uncompress.git,main
Then run
ansible-galaxy install -r requirements.yml
---
- name: install cheat # https://github.com/cheat/cheat/blob/master/INSTALLING.md
tags: cheat
become: true
compscidr.uncompress:
copy: no
src: https://github.com/cheat/cheat/releases/download/4.3.1/cheat-linux-amd64.gz
dest: /usr/local/bin/cheat
mode: '755'This collection uses Molecule for testing with Docker containers across multiple Ubuntu versions (20.04, 22.04, and 24.04).
- Python 3.8 or later
- Docker (running daemon)
- Docker permissions for your user (or run tests as a user in the docker group)
-
Clone the repository:
git clone https://github.com/compscidr/ansible-uncompress.git cd ansible-uncompress -
Create and activate a Python virtual environment:
# On Linux/macOS python3 -m venv venv source venv/bin/activate # On Windows python -m venv venv venv\Scripts\activate
-
Install test dependencies:
pip install -r requirements.txt
-
Install required Ansible collections:
ansible-galaxy collection install community.docker
Full test suite (recommended for CI/CD):
molecule testThis runs the complete test sequence:
- Syntax validation
- Container creation
- Dependency installation
- Test playbook execution
- Idempotence check
- Verification tests
- Cleanup and destruction
Development workflow (faster iteration):
molecule create # Create test containers
molecule converge # Run the test playbook
molecule verify # Run verification tests
molecule destroy # Clean up containersTest a specific platform:
molecule test --platform-name ubuntu-22.04Available platforms: ubuntu-20.04, ubuntu-22.04, ubuntu-24.04
Reset the test environment:
molecule destroy # Clean up existing containers
molecule reset # Clear configurationThe molecule tests validate:
- Downloading and uncompressing remote
.gzfiles - Uncompressing local
.gzfiles withcopy: true - Uncompressing
.bz2files - File permissions are set correctly
- Decompressed file contents are valid
- Operations are idempotent (running twice produces the same result)
When done testing:
deactivate