Skip to content

adarsh-k27r/LVM-Automation-with-Ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LVM Management Tool

A comprehensive Linux Volume Management (LVM) tool that provides both interactive command-line interface and automated deployment capabilities through Ansible.

Features

  • Interactive CLI for LVM operations
  • Automated deployment using Ansible
  • Support for all major LVM operations:
    • Disk management
    • Volume Group (VG) operations
    • Logical Volume (LV) operations
    • Partition and mount point management
    • Volume resizing (extend/reduce)
    • Safe deletion of VGs and LVs

Prerequisites

  • Python 3.x
  • Ansible (for automated deployment)
  • Linux system with LVM support
  • Root/sudo privileges for LVM operations

Installation

Manual Installation

  1. Clone the repository:
git clone https://github.com/adarsh-k27r/LVM-Automation-with-Ansible.git
cd LVM
  1. Install required Python packages:
pip install pyfiglet termcolor
  1. Make the script executable:
chmod +x lvm.py

Automated Installation (Using Ansible)

  1. Clone the repository:
git clone https://github.com/adarsh-k27r/LVM-Automation-with-Ansible.git
cd LVM
  1. Run the Ansible playbook:
ansible-playbook -i inventory.ini ansible_playbooks/lvm_deploy.yml

Usage

Interactive Mode

Run the script:

./lvm.py

The interactive menu provides the following options:

  1. View all available disks
  2. View all existing volume groups
  3. View a specific volume group
  4. View all logical volumes
  5. View partitions and mount points
  6. Create a new volume group
  7. Create a new logical volume
  8. Resize a logical volume
  9. Remove a volume group
  10. Delete a logical volume
  11. Exit

Automated Deployment

The project includes Ansible playbooks for automated deployment:

  • lvm_deploy.yml: Sets up the environment and deploys the LVM management script
  • inventory.ini: Contains the target hosts configuration

Project Structure

LVM/
├── lvm.py                 # Main LVM management script
├── inventory.ini          # Ansible inventory file
├── ansible_playbooks/     # Ansible automation scripts
│   └── lvm_deploy.yml     # Deployment playbook
└── README.md             # This documentation

Safety Features

  • Confirmation prompts for destructive operations
  • Filesystem checks before resizing
  • Proper unmounting before volume deletion
  • Error handling and validation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Author

Adarsh Kumar

Releases

No releases published

Packages

No packages published

Languages