Automated filesystem extension detection and management for AWS EC2 RHEL-based instances.
This Ansible role automatically detects and extends filesystem partitions on AWS EC2 instances running RHEL-based distributions. It provides intelligent detection of available disk space, automatic partition extension, and filesystem growth while maintaining system stability and data integrity.
- Automatic detection of extendable disk devices
- Support for XFS, EXT4, and EXT3 filesystems
- Configurable thresholds for extension triggers
- Dry-run mode for safe testing
- Partition table backup before modifications
- AWS EC2 optimized device detection
- Comprehensive logging and reporting
- Ansible >= 2.12
- Target systems: RHEL 8/9, CentOS 8/9, Amazon Linux 2/2023
- Root privileges on target hosts
- Cloud-utils-growpart package availability
Variable | Default | Description |
---|---|---|
filesystem_extension_enabled |
true |
Enable/disable filesystem extension |
filesystem_extension_auto_extend |
true |
Automatically extend when conditions are met |
filesystem_extension_dry_run |
false |
Only check and report, don't make changes |
Variable | Default | Description |
---|---|---|
filesystem_extension_devices |
["/dev/xvda", "/dev/xvdf", "/dev/nvme0n1", "/dev/nvme1n1"] |
Disk devices to check |
filesystem_extension_max_partitions |
5 |
Maximum partitions to check per device |
Variable | Default | Description |
---|---|---|
filesystem_extension_threshold_percent |
10 |
Minimum free space percentage trigger |
filesystem_extension_threshold_gb |
5 |
Minimum free space GB trigger |
Variable | Default | Description |
---|---|---|
filesystem_extension_supported_fs |
["xfs", "ext4", "ext3"] |
Supported filesystem types |
filesystem_extension_backup_partition_table |
true |
Backup partition table before changes |
filesystem_extension_log_level |
info |
Log level for operations |
None. This role manages its own package dependencies.
---
- hosts: aws_ec2_instances
become: yes
roles:
- damarseta.filesystem-extension
---
- hosts: aws_ec2_instances
become: yes
vars:
filesystem_extension_threshold_percent: 5
filesystem_extension_threshold_gb: 10
filesystem_extension_devices:
- /dev/xvda
- /dev/nvme0n1
roles:
- damarseta.filesystem-extension
---
- hosts: aws_ec2_instances
become: yes
vars:
filesystem_extension_dry_run: true
roles:
- damarseta.filesystem-extension
ansible-playbook -i inventory site.yml --tags filesystem-extension
ansible-playbook -i inventory site.yml -e "filesystem_extension_dry_run=true"
ansible-playbook -i inventory site.yml -e "filesystem_extension_threshold_percent=15"
filesystem-extension
: All taskspackages
: Package installationdetection
: Device and filesystem detectionanalysis
: Filesystem analysisextension
: Filesystem extension operationssummary
: Summary and reporting
- Amazon Linux 2
- Amazon Linux 2023
- RHEL 8.x
- RHEL 9.x
- CentOS 8.x
- CentOS 9.x
- Rocky Linux 8.x/9.x
- AlmaLinux 8.x/9.x
- Automatic detection of EBS volume types
- Support for NVMe and traditional block devices
- Integration with EC2 instance metadata
- Optimized for common AWS storage patterns
- Partition table backup before modifications
- Dry-run mode for testing
- Filesystem type validation
- Error handling and rollback capabilities
- Comprehensive logging
-
Permission denied errors
- Ensure the playbook runs with
become: yes
- Verify sudo privileges on target hosts
- Ensure the playbook runs with
-
Package installation failures
- Check repository configuration
- Verify network connectivity
- Ensure package manager is functional
-
Device not found
- Verify device paths in
filesystem_extension_devices
- Check
lsblk
output on target system - Ensure devices are attached to EC2 instance
- Verify device paths in
Enable debug output:
vars:
filesystem_extension_log_level: debug
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License. See LICENSE file for details.
Copyleft 2025 - Damarseta Infrastructure Team.
- Website: https://damarseta.id
- Email: [email protected]
For issues and feature requests, please use the GitHub issue tracker.