mirror of
https://github.com/mrlesmithjr/ansible-manage-lvm.git
synced 2026-09-03 14:08:14 +03:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b36f4779f | |||
| 164b50b083 | |||
| 7328da933e | |||
| af9951c5cd | |||
| 454649d90b | |||
| 12f7033566 | |||
| 9a5d1dfc15 | |||
| 2f56dc54ad | |||
| 9f6bac5d63 | |||
| 9ffff49ef8 | |||
| 113974cccc |
@@ -0,0 +1 @@
|
|||||||
|
github: mrlesmithjr
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "monthly"
|
||||||
|
groups:
|
||||||
|
github-actions:
|
||||||
|
patterns: ["*"]
|
||||||
|
labels: ["dependencies"]
|
||||||
|
commit-message:
|
||||||
|
prefix: "ci"
|
||||||
|
|
||||||
|
- package-ecosystem: "pip"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "monthly"
|
||||||
|
groups:
|
||||||
|
python-deps:
|
||||||
|
patterns: ["*"]
|
||||||
|
labels: ["dependencies"]
|
||||||
|
commit-message:
|
||||||
|
prefix: "chore"
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
---
|
name: CI
|
||||||
name: Molecule
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
@@ -11,22 +10,17 @@ on:
|
|||||||
- main
|
- main
|
||||||
- master
|
- master
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
lint:
|
||||||
|
name: Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
max-parallel: 4
|
|
||||||
matrix:
|
|
||||||
python-version: [3.9]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: '3.11'
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
---
|
|
||||||
name: Ansible Galaxy
|
name: Ansible Galaxy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
@@ -14,21 +10,21 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
submodules: recursive
|
- name: Set up Python
|
||||||
- name: Set up Python 3.9
|
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
python-version: '3.11'
|
||||||
- uses: actions/cache@v4
|
|
||||||
with:
|
- name: Install Ansible
|
||||||
path: ~/.cache/pip
|
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-pip-
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r requirements.txt -r requirements-dev.txt
|
pip install ansible-core
|
||||||
- name: Trigger a new import on Galaxy.
|
|
||||||
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
|
- name: Trigger a new import on Galaxy
|
||||||
|
run: >-
|
||||||
|
ansible-galaxy role import
|
||||||
|
--api-key ${{ secrets.GALAXY_API_KEY }}
|
||||||
|
${{ github.repository_owner }}
|
||||||
|
${{ github.event.repository.name }}
|
||||||
|
|
||||||
|
|||||||
@@ -1,64 +1,122 @@
|
|||||||
# ansible-manage-lvm
|
# ansible-manage-lvm
|
||||||
|
|
||||||
Ansible role to manage LVM Groups/Logical Volumes.
|
An [Ansible](https://www.ansible.com) role to create, extend, and resize [LVM](https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)) volume groups and logical volumes.
|
||||||
|
|
||||||
> NOTE: Can be used to create, extend or resize LVM Groups and volumes.
|
> Used by [OpenStack Kayobe](https://docs.openstack.org/kayobe/latest/) for LVM management.
|
||||||
|
|
||||||
## ⚠️ Important: Ansible Galaxy Role Name
|
## Ansible Galaxy
|
||||||
|
|
||||||
**As of December 2025**, this role is available on Ansible Galaxy as:
|
```bash
|
||||||
|
ansible-galaxy install mrlesmithjr.manage_lvm
|
||||||
```yaml
|
|
||||||
- src: mrlesmithjr.manage_lvm # Note: underscore, not hyphen
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The previous role names (`mrlesmithjr.manage-lvm` and `mrlesmithjr.manage_lvm`) were
|
> **Note:** As of December 2025, the canonical Galaxy name is `mrlesmithjr.manage_lvm` (underscore).
|
||||||
consolidated into a single role. If you were using `mrlesmithjr.manage-lvm`, please
|
> Update any `requirements.yml` using the older hyphen-style name `mrlesmithjr.manage-lvm`.
|
||||||
update your `requirements.yml` to use `mrlesmithjr.manage_lvm`.
|
|
||||||
|
|
||||||
**Note:** This role is used by [OpenStack Kayobe](https://docs.openstack.org/kayobe/latest/)
|
<details>
|
||||||
for LVM management. The `manage_lvm` name was preserved to maintain compatibility.
|
<summary>Historical download statistics</summary>
|
||||||
|
|
||||||
### Historical Download Statistics
|
|
||||||
|
|
||||||
Prior to consolidation, this role had accumulated significant usage:
|
|
||||||
|
|
||||||
| Role Name | Downloads (as of Dec 2025) |
|
| Role Name | Downloads (as of Dec 2025) |
|
||||||
|-----------|---------------------------|
|
|-----------|---------------------------|
|
||||||
| `mrlesmithjr.manage_lvm` | 697,492 |
|
| `mrlesmithjr.manage_lvm` | 697,492 |
|
||||||
| `mrlesmithjr.manage-lvm` | 494,517 |
|
| `mrlesmithjr.manage-lvm` | 494,517 |
|
||||||
| **Combined Total** | **1,192,009** |
|
| **Combined** | **1,192,009** |
|
||||||
|
|
||||||
Due to Ansible Galaxy limitations, download counts reset when roles are re-imported.
|
Download counts reset when roles are re-imported to Galaxy. These figures represent actual historical usage.
|
||||||
The historical data above represents the actual community usage of this role.
|
</details>
|
||||||
|
|
||||||
|
## Supported Platforms
|
||||||
|
|
||||||
|
Any Linux distribution with LVM support, including:
|
||||||
|
|
||||||
|
| Platform | Versions |
|
||||||
|
|----------|----------|
|
||||||
|
| Ubuntu | 20.04, 22.04, 24.04 |
|
||||||
|
| Debian | 11, 12 |
|
||||||
|
| Rocky Linux / RHEL | 8, 9 |
|
||||||
|
| Fedora | 39+ |
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
Devices/disks to be members of the LVM setup **must be** identified prior to
|
- Unpartitioned disk devices to assign to volume groups
|
||||||
using this role.
|
- `lvm2` package (installed automatically by the role)
|
||||||
|
|
||||||
## Role Variables
|
## Important: Safety Default
|
||||||
|
|
||||||
[defaults/main.yml](defaults/main.yml)
|
`manage_lvm` defaults to `false`. **The role will not make any disk changes** unless you explicitly set:
|
||||||
|
|
||||||
## Dependencies
|
```yaml
|
||||||
|
manage_lvm: true
|
||||||
|
```
|
||||||
|
|
||||||
None
|
This prevents accidental modifications on misconfigured runs.
|
||||||
|
|
||||||
## Example Playbook
|
## Quick Start
|
||||||
|
|
||||||
[playbook.yml](playbook.yml)
|
```yaml
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
manage_lvm: true
|
||||||
|
lvm_groups:
|
||||||
|
- vgname: data-vg
|
||||||
|
disks:
|
||||||
|
- /dev/sdb
|
||||||
|
create: true
|
||||||
|
lvnames:
|
||||||
|
- lvname: data
|
||||||
|
size: 100%FREE
|
||||||
|
create: true
|
||||||
|
filesystem: ext4
|
||||||
|
mount: true
|
||||||
|
mntp: /data
|
||||||
|
roles:
|
||||||
|
- role: mrlesmithjr.manage_lvm
|
||||||
|
```
|
||||||
|
|
||||||
|
## Key Variables
|
||||||
|
|
||||||
|
| Variable | Default | Description |
|
||||||
|
|----------|---------|-------------|
|
||||||
|
| `manage_lvm` | `false` | Master switch — must be `true` to make any changes |
|
||||||
|
| `lvm_groups` | `[]` | List of volume group definitions |
|
||||||
|
| `pvresize_to_max` | `false` | Resize all PVs to maximum available size |
|
||||||
|
|
||||||
|
### `lvm_groups` Structure
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
lvm_groups:
|
||||||
|
- vgname: my-vg # Volume group name
|
||||||
|
disks: # Physical volumes to assign
|
||||||
|
- /dev/sdb
|
||||||
|
- /dev/sdc
|
||||||
|
create: true # true = create, false = remove
|
||||||
|
pvresize: false # Resize PV to max size
|
||||||
|
lvnames:
|
||||||
|
- lvname: data # Logical volume name
|
||||||
|
size: 50g # Size: 10g | 1024 (MB) | 100%FREE
|
||||||
|
create: true # true = create, false = remove
|
||||||
|
filesystem: ext4 # ext4 | xfs | swap | etc.
|
||||||
|
mount: true # Mount after creation
|
||||||
|
mntp: /data # Mountpoint
|
||||||
|
mopts: noatime # Mount options (optional)
|
||||||
|
fsopts: # Filesystem creation options (optional)
|
||||||
|
```
|
||||||
|
|
||||||
|
See [defaults/main.yml](defaults/main.yml) for full examples including XFS, swap, and OpenStack Cinder volumes.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|
||||||
## Author Information
|
## Support This Project
|
||||||
|
|
||||||
Larry Smith Jr.
|
This role has been downloaded over **1.1 million times** from Ansible Galaxy.
|
||||||
|
If your organization depends on it in production, consider
|
||||||
|
[sponsoring its maintenance](https://github.com/sponsors/mrlesmithjr).
|
||||||
|
Enterprise support tiers are available.
|
||||||
|
|
||||||
- [@mrlesmithjr](https://twitter.com/mrlesmithjr)
|
## Author
|
||||||
- [mrlesmithjr@gmail.com](mailto:mrlesmithjr@gmail.com)
|
|
||||||
- [http://everythingshouldbevirtual.com](http://everythingshouldbevirtual.com)
|
|
||||||
|
|
||||||
<a href="https://www.buymeacoffee.com/mrlesmithjr" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
Larry Smith Jr. — [everythingshouldbevirtual.com](http://everythingshouldbevirtual.com) · [mrlesmithjr@gmail.com](mailto:mrlesmithjr@gmail.com)
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
"extends": ["github>mrlesmithjr/renovate-config"]
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,7 @@ click-help-colors==0.9.1 ; python_version >= "3.9" and python_version < "4.0"
|
|||||||
click==8.1.3 ; python_version >= "3.9" and python_version < "4.0"
|
click==8.1.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0" and sys_platform == "win32" or python_version >= "3.9" and python_version < "4.0" and platform_system == "Windows"
|
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0" and sys_platform == "win32" or python_version >= "3.9" and python_version < "4.0" and platform_system == "Windows"
|
||||||
cookiecutter==2.1.1 ; python_version >= "3.9" and python_version < "4.0"
|
cookiecutter==2.1.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
cryptography==41.0.1 ; python_version >= "3.9" and python_version < "4.0"
|
cryptography==46.0.6 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
dill==0.3.6 ; python_version >= "3.9" and python_version < "4.0"
|
dill==0.3.6 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
distlib==0.3.6 ; python_version >= "3.9" and python_version < "4.0"
|
distlib==0.3.6 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
enrich==1.2.7 ; python_version >= "3.9" and python_version < "4.0"
|
enrich==1.2.7 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
@@ -47,7 +47,7 @@ pre-commit==2.21.0 ; python_version >= "3.9" and python_version < "4.0"
|
|||||||
pycodestyle==2.10.0 ; python_version >= "3.9" and python_version < "4.0"
|
pycodestyle==2.10.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pycparser==2.21 ; python_version >= "3.9" and python_version < "4.0"
|
pycparser==2.21 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pyflakes==3.0.1 ; python_version >= "3.9" and python_version < "4.0"
|
pyflakes==3.0.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pygments==2.15.1 ; python_version >= "3.9" and python_version < "4.0"
|
pygments==2.20.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pylint==2.17.4 ; python_version >= "3.9" and python_version < "4.0"
|
pylint==2.17.4 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pyrsistent==0.19.3 ; python_version >= "3.9" and python_version < "4.0"
|
pyrsistent==0.19.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
python-dateutil==2.8.2 ; python_version >= "3.9" and python_version < "4.0"
|
python-dateutil==2.8.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
ansible-core==2.13.10 ; python_version >= "3.9" and python_version < "4.0"
|
ansible-core==2.13.10 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
ansible==6.6.0 ; python_version >= "3.9" and python_version < "4.0"
|
ansible==6.6.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
cffi==1.15.1 ; python_version >= "3.9" and python_version < "4.0"
|
cffi==1.15.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
cryptography==41.0.1 ; python_version >= "3.9" and python_version < "4.0"
|
cryptography==46.0.6 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
jinja2==3.1.2 ; python_version >= "3.9" and python_version < "4.0"
|
jinja2==3.1.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "4.0"
|
markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
packaging==23.1 ; python_version >= "3.9" and python_version < "4.0"
|
packaging==23.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user