Compare commits

..

120 Commits

Author SHA1 Message Date
Larry Smith Jr. 1b5981848c Update Python dependencies to resolve security vulnerabilities
Regenerated pinned requirements from source files with latest
compatible package versions to address open Dependabot alerts.
2026-03-25 16:03:23 -04:00
Larry Smith Jr. 2c41273c9f Add Renovate configuration for automated dependency management 2026-03-25 15:55:03 -04:00
Larry Smith Jr. 6d0feecec7 docs: add Galaxy role name clarification and historical stats
As of December 2025, this role is available on Galaxy as
mrlesmithjr.manage_lvm (underscore). The previous hyphenated
variant (manage-lvm) was consolidated.

Added historical download statistics:
- manage_lvm: 697,492 downloads
- manage-lvm: 494,517 downloads
- Combined: 1,192,009 downloads

This role is used by OpenStack Kayobe for LVM management.
2025-12-18 15:11:16 -05:00
Larry Smith Jr. 416e840eea fix: specify Python 3.9 for Galaxy workflow
- Remove undefined matrix.python-version reference
- Use Python 3.9 to match molecule workflow and requirements
2025-11-03 07:29:16 -05:00
Larry Smith Jr. 850d571313 fix: update GitHub Actions to use current versions
- Update actions/checkout to v4
- Update actions/setup-python to v5
- Update actions/cache to v4 (fixes deprecation failures)
- Fix ansible-lint role-name rule violations
2025-11-03 07:28:15 -05:00
Spirit-act ff13947aaf fix: use explicit boolean check for Ansible 2.19+ compatibility
Fixes implicit truthy conditional that fails in Ansible 2.19+.

Changes `when: scsi_devices['stdout'] | length` to `when: scsi_devices['stdout'] | length > 0` to return an explicit boolean value instead of an integer.

Closes #146 (duplicate PR)
2025-11-01 15:55:35 -04:00
Larry Smith Jr. 26246c7160 Merge pull request #128 from stackhpc/remove-symlinks
Remove symlinks for molecule tests
2024-07-17 17:12:38 -04:00
Matt Crees 5540f7fda5 Remove symlinks for molecule tests
We are seeing failures with newer versions of Ansible due to the
presence of symlinks. For example:

```
error: can't copy 'ansible/roles/mrlesmithjr.manage_lvm/molecule/kvm/tests': doesn't exist or not a regular file
```
2024-05-21 17:16:05 +01:00
Larry Smith Jr 433b7ca1a9 Merge pull request #121 from mrlesmithjr/dependabot/pip/cryptography-42.0.2
Bump cryptography from 42.0.0 to 42.0.2
2024-02-16 22:55:08 -05:00
dependabot[bot] 9404a780c5 Bump cryptography from 42.0.0 to 42.0.2
Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.0 to 42.0.2.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/42.0.0...42.0.2)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-17 00:09:34 +00:00
Larry Smith Jr c0184492d5 Merge pull request #120 from mrlesmithjr/dependabot/pip/ansible-core-2.15.9
Bump ansible-core from 2.15.8 to 2.15.9
2024-02-06 23:51:00 -05:00
Larry Smith Jr 60e08852ea Merge pull request #119 from mrlesmithjr/dependabot/pip/cryptography-42.0.0
Bump cryptography from 41.0.6 to 42.0.0
2024-02-06 23:49:52 -05:00
dependabot[bot] 42cc915582 Bump ansible-core from 2.15.8 to 2.15.9
Bumps [ansible-core](https://github.com/ansible/ansible) from 2.15.8 to 2.15.9.
- [Release notes](https://github.com/ansible/ansible/releases)
- [Commits](https://github.com/ansible/ansible/compare/v2.15.8...v2.15.9)

---
updated-dependencies:
- dependency-name: ansible-core
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-06 20:34:35 +00:00
dependabot[bot] 49edca9134 Bump cryptography from 41.0.6 to 42.0.0
Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.6 to 42.0.0.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/41.0.6...42.0.0)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-06 02:23:10 +00:00
Larry Smith Jr ee1e3d051b Merge pull request #118 from genaumann/pvresize_from_module
Add pvresize option
2024-01-17 00:21:19 -05:00
Gino Naumann 91f8cfca5d Add pvresize option
You can now define the pvresize per vg.

To avoid a breaking change, the global option pvresize_to_max is set as default
2024-01-16 12:50:12 +01:00
Larry Smith Jr 3ac9669088 Merge pull request #115 from mrlesmithjr/dependabot/pip/jinja2-3.1.3
Bump jinja2 from 3.1.2 to 3.1.3
2024-01-16 00:30:35 -05:00
Larry Smith Jr 4219da5423 Merge pull request #117 from jcox10/fix-module-names
fix commuity.general module names
2024-01-16 00:30:17 -05:00
Jason Cox 683c617265 fix commuity.general module names 2024-01-15 11:00:08 -07:00
dependabot[bot] b41ffc5e58 Bump jinja2 from 3.1.2 to 3.1.3
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-11 21:01:26 +00:00
Larry Smith Jr 564d3d1f6f Merge pull request #114 from mrlesmithjr/dependabot/pip/ansible-8.5.0
Bump ansible from 6.6.0 to 8.5.0
2023-12-31 15:51:01 -05:00
dependabot[bot] 1d0fa70d66 Bump ansible from 6.6.0 to 8.5.0
Bumps [ansible](https://github.com/ansible-community/ansible-build-data) from 6.6.0 to 8.5.0.
- [Changelog](https://github.com/ansible-community/ansible-build-data/blob/main/docs/release-process.md)
- [Commits](https://github.com/ansible-community/ansible-build-data/compare/6.6.0...8.5.0)

---
updated-dependencies:
- dependency-name: ansible
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-29 18:31:56 +00:00
Larry Smith Jr 8c3bca39ec Merge pull request #113 from mrlesmithjr/dependabot/pip/cryptography-41.0.6 2023-11-30 19:40:06 -05:00
dependabot[bot] 4fbcf1cd19 Bump cryptography from 41.0.1 to 41.0.6
Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.1 to 41.0.6.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/41.0.1...41.0.6)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-28 23:43:00 +00:00
Larry Smith Jr 11056e2e60 Merge pull request #104 from mrlesmithjr/refactoring
Refactoring
2023-06-15 09:07:11 -04:00
Larry Smith Jr 220de2d8ac Fixed linting issues found by black 2023-06-15 09:04:02 -04:00
Larry Smith Jr 3f3a7c7334 Fixed linting issues with templates 2023-06-15 09:00:02 -04:00
Larry Smith Jr f901fe42b3 Removed molecule lint as it doesn't exist anymore
- replaced with pre-commit linting checks
2023-06-15 08:57:06 -04:00
Larry Smith Jr d27a3809d9 Fixed linting issues 2023-06-15 08:52:28 -04:00
Larry Smith Jr 51b7015f9c Updated Python requirements 2023-06-14 21:14:30 -04:00
Larry Smith Jr e35a250f7b Added pre-commit config 2023-06-14 21:07:48 -04:00
Larry Smith Jr de0507269b Updated Python requirements 2023-06-14 21:07:35 -04:00
Larry Smith Jr 1b7e7e6b1c Removed Travis testing and old changelog 2023-06-14 21:07:13 -04:00
Larry Smith Jr 84ba07bcaf Merge branch 'Aethylred-fsopts' 2023-06-14 20:48:02 -04:00
Larry Smith Jr a623248cdf Fixing Molecule lint test 2023-06-14 20:43:47 -04:00
Larry Smith Jr 55b1745ac3 Merge branch 'fsopts' of github.com:Aethylred/ansible-manage-lvm into Aethylred-fsopts 2023-06-14 20:39:51 -04:00
Larry Smith Jr c020c6ef2d Merge pull request #103 from mrlesmithjr/dependabot/pip/cryptography-41.0.0
Bump cryptography from 36.0.0 to 41.0.0
2023-06-04 00:49:41 -04:00
dependabot[bot] 47c980797d Bump cryptography from 36.0.0 to 41.0.0
Bumps [cryptography](https://github.com/pyca/cryptography) from 36.0.0 to 41.0.0.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/36.0.0...41.0.0)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-02 18:51:29 +00:00
Aaron Hicks d6dd5184f0 Merge branch 'fsopts' of github.com:Aethylred/ansible-manage-lvm into fsopts 2023-05-30 15:15:18 +12:00
Aaron Hicks 74e7ca5652 Pass through opts to community.general.filesystem when creating a filesystem 2023-05-30 15:14:51 +12:00
Larry Smith Jr 12346fa038 Update README.md 2023-05-29 10:28:29 -04:00
Larry Smith Jr 8dc044f7c2 Merge pull request #100 from mrlesmithjr/dependabot/pip/gitpython-3.1.30 2023-05-26 01:27:38 -04:00
Larry Smith Jr aa66814872 Merge pull request #101 from mrlesmithjr/dependabot/pip/requests-2.31.0 2023-05-26 01:22:38 -04:00
dependabot[bot] 6e4f217d74 Bump requests from 2.26.0 to 2.31.0
Bumps [requests](https://github.com/psf/requests) from 2.26.0 to 2.31.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.26.0...v2.31.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-23 02:06:03 +00:00
dependabot[bot] 483ed18874 Bump gitpython from 3.1.24 to 3.1.30
Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.24 to 3.1.30.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.24...3.1.30)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-16 20:23:09 +00:00
Larry Smith Jr ea2e60f043 Merge pull request #96 from mnasiadka/ansible_facts_distribution
Change ansible_distribution usage to ansible_facts
2022-10-19 15:13:46 -04:00
Michal Nasiadka a28791cc48 Change ansible_distribution usage to ansible_facts
Closes #95
2022-10-13 15:55:07 +02:00
Aaron Hicks b5bf2d266c Pass through opts to community.general.filesystem when creating a filesystem 2022-08-04 14:47:03 +12:00
Larry Smith Jr ca903442c8 Merge pull request #89 from msielicki/master
skip resizing swap filesystem
2022-05-30 09:01:51 -04:00
Larry Smith Jr 9e69c74f71 Merge pull request #91 from msielicki/fix_for_debian_testing
fix for debian testing / sid
2022-05-30 09:01:41 -04:00
Mariusz Sielicki e9ff7e3faf fix for debian testing / sid 2022-05-27 18:23:17 +02:00
Mariusz Sielicki 84bfdf54ad skip resizing swap filesystem 2022-05-27 17:56:09 +02:00
Larry Smith Jr 376f2ce641 Merge pull request #86 from smutel/FixIssue85
Add variable rescan_scsi_command
2022-04-26 09:30:50 -04:00
Samuel Mutel 6e74c9714e enh: Add variable rescan_scsi_command 2022-04-11 13:49:46 +02:00
Larry Smith Jr 1f966d2ea1 Merge pull request #81 from christian7007/master 2022-01-13 08:39:41 -05:00
Christian González 71a3930e5b Fix syntax error on tasks/centos.yml 2022-01-13 10:50:13 +01:00
Larry Smith Jr 263c8d2b3f Merge pull request #73 from mnasiadka/mnasiadka/nvme_only
centos: Skip SCSI tasks on NVMe only hosts
2022-01-04 14:47:16 -05:00
Michal Nasiadka 0bfd390ace centos: Skip SCSI tasks on NVMe only hosts 2021-12-10 15:01:59 +01:00
Larry Smith Jr 71bc56d733 Merge pull request #70 from cityofships/optimize
CentOS: Optimise package installs
2021-11-22 15:12:41 -05:00
Larry Smith Jr 59ca2aae95 Pythonr reqs exported after #69 2021-11-22 14:29:40 -05:00
Piotr Parczewski cb3a75c984 CentOS: Optimise package installs 2021-11-22 20:27:27 +01:00
Larry Smith Jr fae4332de8 Merge pull request #69 from mrlesmithjr/dependabot/pip/ansible-4.2.0
Bump ansible from 2.9.7 to 4.2.0
2021-11-22 14:23:45 -05:00
Larry Smith Jr 3ea52cdda8 Merge pull request #76 from mrlesmithjr:mrlesmithjr/issue75_Add-Ansible-Galaxy-release-workflow
Add Ansible Galaxy release workflow
2021-11-22 14:19:00 -05:00
Larry Smith Jr 2d020f26d8 Add Ansible Galaxy release workflow
Fixes #75
2021-11-22 14:16:03 -05:00
dependabot[bot] 558cd7460e Bump ansible from 2.9.7 to 4.2.0
Bumps [ansible](https://github.com/ansible/ansible) from 2.9.7 to 4.2.0.
- [Release notes](https://github.com/ansible/ansible/releases)
- [Commits](https://github.com/ansible/ansible/commits)

---
updated-dependencies:
- dependency-name: ansible
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-22 19:15:36 +00:00
Larry Smith Jr 3b00335935 Merge pull request #72 from mrlesmithjr/mrlesmithjr/issue71_Fix-Galaxy-meta-info 2021-11-22 14:12:18 -05:00
Larry Smith Jr ac014a161e Fix Python version 2021-11-22 14:00:46 -05:00
Larry Smith Jr 9446ef21d6 Fix Galaxy meta info
Fixes #71
2021-11-22 13:56:40 -05:00
Larry Smith Jr 97300430ad Fix Galaxy meta info
Fixes #71
2021-11-22 08:48:18 -05:00
Larry Smith Jr 73db3c747c Merge pull request #68 from stackhpc/ansible-facts
Use ansible_facts to reference facts
2021-07-26 14:25:57 -04:00
Mark Goddard 73b6bce608 Use ansible_facts to reference facts
By default, Ansible injects a variable for every fact, prefixed with
ansible_. This can result in a large number of variables for each host,
which at scale can incur a performance penalty. Ansible provides a
configuration option [0] that can be set to False to prevent this
injection of facts. In this case, facts should be referenced via
ansible_facts.<fact>.

This change updates all references to Ansible facts from using
individual fact variables to using the items in the
ansible_facts dictionary. This allows users to disable fact variable
injection in their Ansible configuration, which may provide some
performance improvement.

[0] https://docs.ansible.com/ansible/latest/reference_appendices/config.html#inject-facts-as-vars
2021-05-13 17:21:42 +01:00
Larry Smith Jr 098bd79154 Merge pull request #64 from mrlesmithjr/issue-63-Add_Probot_configs_for_new_apps
Closes Add Probot configs for new apps #63
2021-04-23 20:58:39 -04:00
Larry Smith Jr fddf9804dd Closes Add Probot configs for new apps #63 2021-04-23 20:56:44 -04:00
Larry Smith Jr 506da4707e Create stale.yml 2021-04-23 00:20:15 -04:00
Larry Smith Jr 773ce28061 Merge pull request #57 from Roxyrob/issue-51-nvme
mitigation for aws ec2 nvme random device name assignment + scsi device rescan + auto pvresize + skip scsi if scsi adapter not installed
2021-04-18 08:49:45 -04:00
Roxyrob 1bb56066fe * Doc: set subfile task comments 2021-03-19 19:28:54 +01:00
Roxyrob cb792e59a6 * Refactor: aws code in its own tasks file to mitigate concerns about performance at scale 2021-03-18 15:38:22 +01:00
Roxyrob 48e3be3c5c * Refactor: task comment review 2021-03-17 13:46:10 +01:00
Roxyrob 2492c96566 * Fix: allow automatic pvresize also for ansible ersion 2.10 or above without new lvg collection version installed 2021-03-17 10:01:24 +01:00
Roxyrob e4bc8a9e9b * Fix: lint 2021-03-17 01:40:26 +01:00
Roxyrob 1d57a469b0 * Fix: pvresize waiting for new collection lvg native support 2021-03-17 01:29:14 +01:00
Roxyrob 19e56ac7d8 * Fix: improve centos7/8 recognize scsi disk resize without reboot 2021-03-17 01:24:15 +01:00
Roxyrob 5c3e601078 * Fix: lint 2021-03-17 01:13:53 +01:00
Roxyrob 535b410363 * Fix: follow best practice for pipe in shell command 2021-03-16 23:24:24 +01:00
Roxyrob f87c42a8c5 * Fix: remove too many blank lines (molecule) 2021-03-16 20:28:13 +01:00
Roxyrob 34e4f08c31 * New: support mitigation for aws ec2 nvme random device name assignment 2021-03-16 19:41:37 +01:00
Larry Smith Jr f1a54639c6 Merge pull request #48 from Tcharl/rebased
XFS resize
2020-06-07 20:05:35 -04:00
Larry Smith Jr 88489df0ac Merge pull request #45 from OsgiliathEnterprise/master
Allow to define only volume groups
2020-06-07 20:05:22 -04:00
Charlie Mordant b288695b9a lint 2020-06-07 17:25:33 +02:00
Charlie Mordant ed0eb14ce8 xfs resize 2020-06-07 17:17:48 +02:00
Charlie Mordant 9c04be9046 Merge pull request #14 from OsgiliathEnterprise/rebased
Rebased from upstream
2020-05-15 00:03:37 +02:00
Charlie Mordant 96fd3b2b06 rebase done 2020-05-14 23:46:35 +02:00
Charlie Mordant 15b2b7b4e0 rebased mrjsmith 2020-05-14 23:43:59 +02:00
Larry Smith Jr 9ead2c9b18 Merge pull request #38 from mrlesmithjr/issue-37
Issue 37
2020-05-14 09:52:39 -04:00
Charlie Mordant 79f4787208 Merge pull request #13 from Tcharl/master
Merge pull request #5 from Tcharl/id2
2020-05-11 18:44:01 +02:00
Charlie Mordant 94582de25d use symbolic links instead of replicating files 2020-05-11 17:38:02 +02:00
Charlie Mordant 6ee72799b4 improve tests 2020-05-11 17:09:58 +02:00
Charlie Mordant 69e25effd4 improve tests 2020-05-11 16:56:04 +02:00
Charlie Mordant 62fc5a5e2b testing singl lv and only vg 2020-05-11 16:35:31 +02:00
Charlie Mordant c40f9b7d03 testing singl lv and only vg 2020-05-11 16:35:00 +02:00
Charlie Mordant 0621cadde8 avoid error when lv not defined 2020-05-11 14:36:04 +02:00
Charlie Mordant b7cef8e323 avoid error when lv not defined 2020-05-11 14:26:48 +02:00
Charlie Mordant 59ffcfac4a avoid error when lv not defined 2020-05-11 14:23:32 +02:00
Charlie Mordant 976ff31d00 avoid error when lv not defined 2020-05-11 14:21:02 +02:00
Charlie Mordant 78205e51cb Merge pull request #12 from Tcharl/id2
rename manage_lvm.yml due to recursive parsing error
2020-05-11 13:53:03 +02:00
Charlie Mordant b731c20100 rename manage_lvm.yml due to recursive parsing error 2020-05-11 13:51:45 +02:00
Charlie Mordant f2df804926 Merge pull request #11 from OsgiliathEnterprise/id2
Id2
2020-05-11 13:39:16 +02:00
Larry Smith Jr 9f37fa3ed1 Cleaned up tasks
These changes include:
- Cleaning up logic of conditionals for more clarity
- Naming of tasks as some were either missing or incorrect
- Removing unnecessary parens, etc.
- Closes #37
2020-04-27 13:50:00 -04:00
Larry Smith Jr c9a9e1660e Cleaned up conditionals logic 2020-04-27 13:47:43 -04:00
Larry Smith Jr ec0737d26b Cleaned up distro specific tasks
- Cleaned up conditions, etc.
2020-04-27 13:47:40 -04:00
Larry Smith Jr 52c0270a53 Updated Molecule Vagrant boxes for testing
- We need to test against CentOS, Fedora, and Ubuntu
- Added my Vagrant boxes to ensure that we know what is included, etc.
- This ensures we can at least test these distros locally
2020-04-27 13:46:08 -04:00
Larry Smith Jr 94be28c09b Updated repo info 2020-04-27 13:43:46 -04:00
Larry Smith Jr a6b07da847 Added example playbook 2020-04-27 13:43:46 -04:00
Larry Smith Jr 643c7b6ee1 Updated Galaxy meta info 2020-04-27 13:43:46 -04:00
Larry Smith Jr b7c3cf9f75 Merge pull request #44 from mrlesmithjr/issue-42
Fix original issue
2020-04-27 13:41:35 -04:00
Larry Smith Jr e423ebd56b Fix original issue
- The previous patch did not resolve the original issue raised. This now
  works and has been tested with the configuration provided as part of
  the open issue.

- Resolves #42
2020-04-27 13:39:59 -04:00
Larry Smith Jr 9eca9e391b Merge pull request #43 from mrlesmithjr/issue-42
Issue 42
2020-04-27 11:58:16 -04:00
Larry Smith Jr 881d5d77fa Fixing syntax issue for wantlist 2020-04-27 11:26:18 -04:00
Larry Smith Jr 89360e3ffe Trying to fix the subelements lookup for a single element
This addresses #42. Will need to do some validation testing, etc.
2020-04-27 11:16:02 -04:00
Charlie Mordant 1e997a3e80 Merge pull request #5 from Tcharl/id2
xfs support on centos
2020-04-23 19:56:02 +02:00
53 changed files with 3443 additions and 787 deletions
+3
View File
@@ -0,0 +1,3 @@
skip_list:
- name[casing]
- role-name
+3
View File
@@ -0,0 +1,3 @@
[flake8]
exclude = .venv/
max-line-length = 88
+14
View File
@@ -0,0 +1,14 @@
# Configuration for request-info - https://github.com/behaviorbot/request-info
# *Required* Comment to reply with
requestInfoReplyComment: >
We would appreciate it if you could provide us with more info about this issue/pr!
# *OPTIONAL* default titles to check against for lack of descriptiveness
# MUST BE ALL LOWERCASE
requestInfoDefaultTitles:
- update readme.md
- updates
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
requestInfoLabelToAdd: needs-more-info
+32
View File
@@ -0,0 +1,32 @@
name-template: "v$RESOLVED_VERSION 🌈"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: "🚀 Features"
labels:
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "🧰 Maintenance"
label: "chore"
- title: "🧺 Miscellaneous" #Everything except ABAP
label: "misc"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
template: |
## Changes
$CHANGES
+10
View File
@@ -0,0 +1,10 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
repository:
# See https://developer.github.com/v3/repos/#edit for all available settings.
# The name of the repository. Changing this will rename the repository
name: ansible-manage-lvm
# A short description of the repository that will show up on GitHub
description: Ansible role to manage LVM Groups/Logical Volumes
+17
View File
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
+29 -29
View File
@@ -1,41 +1,41 @@
---
# This is a basic workflow to help you get started with Actions
name: Molecule
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches-ignore:
- main
- master
pull_request:
branches:
- develop
- main
- master
- tags/*
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint:
# The type of runner that the job will run on
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: [3.9]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: install lint prerequisite
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
sudo apt -y install python3-setuptools ansible-lint
- name: Install molecule
run: |
sudo apt update
sudo apt -y install python3-setuptools python3 python3-pip docker vagrant
sudo pip3 install wheel
sudo pip3 install molecule testinfra yamllint ansible-lint flake8 molecule-vagrant
- name: molecule lint
run: |
molecule lint
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: Check linting with pre-commit
run: pre-commit run --all-files
+17
View File
@@ -0,0 +1,17 @@
name: Release Drafter
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main
- master
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+34
View File
@@ -0,0 +1,34 @@
---
name: Ansible Galaxy
on:
push:
branches:
- main
- master
release:
types:
- published
jobs:
galaxy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- 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)
+1 -1
View File
@@ -1,3 +1,3 @@
.idea
**/__pycache__
venv/
.venv/
+32
View File
@@ -0,0 +1,32 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: no-commit-to-branch
args: [--branch, develop, --branch, master, --branch, main]
- id: trailing-whitespace
- repo: https://github.com/ansible-community/ansible-lint
rev: v6.17.1
hooks:
- id: ansible-lint
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/adrienverge/yamllint
rev: v1.32.0
hooks:
- id: yamllint
-30
View File
@@ -1,30 +0,0 @@
---
dist: bionic
language: python
python:
- "3.8"
before_install:
- |
sudo apt -y install bridge-utils dnsmasq-base ebtables libvirt-bin libvirt-dev qemu-kvm qemu-utils ruby-dev
- |
wget https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_x86_64.deb
sudo apt -y install ./vagrant_2.2.7_x86_64.deb
sudo vagrant plugin install vagrant-libvirt
- |
sudo apt-get -y purge python3-openssl && sudo apt-get -y autoremove
sudo apt-get update && sudo apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo
curl -skL https://bootstrap.pypa.io/get-pip.py | sudo -H python3
sudo pip3 install wheel
sudo pip3 install netaddr python-vagrant yamllint testinfra flake8
sudo pip3 install ansible ansible-lint
sudo pip3 install -I molecule molecule-vagrant
script:
- |
sudo molecule test --scenario-name kvm
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
+1 -1
View File
@@ -3,7 +3,7 @@
extends: default
ignore: |
venv/
.venv/
rules:
braces:
-278
View File
@@ -1,278 +0,0 @@
commit 7e2a076b0a8155015fd21502db860fa89a2114b3
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Sun Apr 19 01:44:38 2020 -0400
Added Python requirements for testing, etc.
Closes #33
commit dadb9f24f7ebc2752e6495c4c3569bdee5e0cc68
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Fri Apr 17 13:12:06 2020 +0200
remove unwanted files
commit 2f63eab727cf7b0b389d0d0cc1a1c7236b71f839
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Fri Apr 17 12:56:31 2020 +0200
code smells
commit 050f8a56f10d81f7827be53b8c769b1aa5021c00
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Wed Apr 15 19:08:34 2020 +0200
typo in check
commit b955a6f073b91773f5f90da878268e74872a99e9
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Wed Apr 15 18:54:17 2020 +0200
remove unwanted newline
commit f81937e9d82bc48f2ee03f6ff462c32bca3da8f0
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Wed Apr 15 18:52:52 2020 +0200
makes xfs mountpoint repeatable
commit 1c3818e5d06887c01dc0a4b88a39c0561a446300
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Wed Apr 15 17:34:53 2020 +0200
mistake on remove volume
commit 47f8dae16a096050dccbb8d161f4a18946a6ae73
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Wed Apr 15 17:13:38 2020 +0200
github action lint
commit 96fa78d6d099d0a48642d377d3e7f30a0c554bdf
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Wed Apr 15 17:07:33 2020 +0200
remove deprecated machines
commit 17e8ec1058c5cb66b21b15a8d3912ac9980508a9
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Wed Apr 15 16:56:18 2020 +0200
configured molecule and fix xfs on centos
commit ba5d929fce982af9baa44cfe8ad0b3079133f444
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Wed Apr 15 15:14:30 2020 +0200
use dots instead of carets
commit ea9109220bb268b5f14e75e38d9fb32c2d79bae5
Author: Charlie Mordant <cmordant1@gmail.com>
Date: Wed Apr 15 14:33:41 2020 +0200
molecule test and idempotence
commit d8b3a4e93257dfeb79bc8d4ef349acb53f0019dc
Author: Samuel Mutel <smu-dw@deveryware.net>
Date: Mon Oct 14 12:21:03 2019 +0200
bug: Resize XFS parts is not working
commit b15ecea51d0045a89aae24e4b0c108b35f060b2c
Author: Tony Peña <emperor.cu@gmail.com>
Date: Wed Jun 26 14:56:13 2019 +0200
Update debian.yml
Since ansible 2.8.0 must be change way using dict
commit 9788ee5df68798ad94f11c8133b1d62ff409d0e8
Author: Michele Caputo <mikap83@gmail.com>
Date: Mon Apr 8 14:16:04 2019 +0200
issue #23: extra parenthesis
commit 0f428a0e40d71aea410fbc1aa329203c0b4f15cd
Author: faisalnizam <faisal@logiik.com>
Date: Tue Mar 26 10:48:45 2019 +0400
FIX LINT FOR BUILD
FIX LINT FOR BUILD
commit 8957630c04b8befa99c08ed667e43d95198202ce
Author: faisalnizam <faisal@logiik.com>
Date: Tue Mar 26 10:40:11 2019 +0400
Adding SWAP FileSystem Exception
Adding Check for SWAP Filesystem if defined skip
1. SKIP New Filesystem Creation
2. SKIP mountpoint check
commit 183087e767cbce08ce2da1a3b04f47d3fc03a7e6
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Tue Apr 2 08:03:42 2019 -0400
Resolves #21
commit b3ef85d4f738597260d9db0d90e84d0f8721259a
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Wed Dec 5 08:39:10 2018 -0500
Added skip codes for ansible-lint
commit 9f4afa7afb3fedc270c44ff1fa357da4b87845c0
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Wed Dec 5 08:00:13 2018 -0500
Fixing Travis testing and yamllint issues
commit 5603c5f6b0899a1b2cdeeeb3c035eb6249e96fa7
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Wed Dec 5 07:51:31 2018 -0500
Added Travis testing and hooks for galaxy
commit 563aa1effba936340cbaad9766a49f570292edee
Author: Mark Goddard <mark@stackhpc.com>
Date: Wed Oct 31 11:42:20 2018 +0000
Fix indentation
commit 4a58cb36cf6d4dd4bb23e86972658be508cca082
Author: Mark Goddard <mark@stackhpc.com>
Date: Wed Oct 31 11:16:27 2018 +0000
Update tasks/manage_lvm.yml
Co-Authored-By: oneswig <stig.github@telfer.org>
commit a0c784797f538fc5393d75589ac48e86c51e88db
Author: Stig Telfer <stig@stackhpc.com>
Date: Wed Oct 31 10:16:44 2018 +0100
Support not formatting volumes.
Logic to make the filesystem attribute optional, in situations where
we do not want the volumes formatted.
commit 66368de1d3d2b6712cbf66fc3dd0962705bf86f9
Author: David Castellanos <dcastellanos@fintonic.com>
Date: Mon Dec 18 00:33:45 2017 +0100
Add opts and mopts support
commit 386cc28bdb58886ed492d3438c9cb088d36de161
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Sun Jun 11 14:57:53 2017 -0400
Addresses issue #10
Signed-off-by: Larry Smith Jr <mrlesmithjr@gmail.com>
commit 0d255cb5ce9e6016a503203c2ed39a70fb0ccd9c
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Fri May 5 09:12:25 2017 -0400
Fixes issue #8
Signed-off-by: Larry Smith Jr <mrlesmithjr@gmail.com>
commit f2d06d0d46086da0191b4dbde0d420e709e3ea01
Author: Stefan Heimberg <kontakt@stefanheimberg.ch>
Date: Thu Apr 6 00:25:55 2017 +0200
added support for btrfs
commit 7749d0c62a6e1539aff94c57fd2c0eeaf43dd1a0
Author: Kevin Loveland <kevin.loveland@gmail.com>
Date: Fri Nov 18 10:26:16 2016 -0800
Fixed issue with idempotency of lvol module. See ansible-module-extras issue #428
commit 3ad965237280d534f0aab0027f9ef61701354e8b
Author: Kevin Loveland <kevin.loveland@gmail.com>
Date: Thu Nov 17 15:17:26 2016 -0800
Changes to adjust to removal of bare vars in Ansible 2.2
commit a82877c290cfe0b62eda90d8874b8e2b62402946
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Sun Oct 2 09:58:47 2016 -0400
First commit of CHANGELOG
Signed-off-by: Larry Smith Jr <mrlesmithjr@gmail.com>
commit 99366fa547faccb0359dd8d3b19cec802640eb95
Author: Rohit Kothari <rohietkothari@gmail.com>
Date: Thu Sep 29 17:59:19 2016 -0700
Replace system-storage-manager with lvm2 in centos
commit ca1535d774b4e3310fc993841f1f99400612c7a5
Author: Olivier LOCARD <olivier.locard@deveryware.com>
Date: Fri Sep 23 16:21:07 2016 +0200
Add xfs_growfs for xfs systemfile type.
commit bb87fa8dbff5df50ed376db74a6d2b95f64fd745
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Tue Nov 3 10:39:58 2015 -0500
updated vars and conditionals
commit 49b20e2e4a80581f1c53559ff4073b3384eae28c
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Tue Nov 3 10:24:54 2015 -0500
updated when conditions
commit 0232734bed92e976376d4c9f2550b515f72f3d54
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Tue Nov 3 10:22:09 2015 -0500
updated tasks to only work when lvnames is defined
commit 9f592112095208843da1fd69a658bd49c163a7bb
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Tue Nov 3 09:37:38 2015 -0500
updated vars and meta
commit 686455514d8bc0da70b3440dbc5afe669188d333
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Tue Nov 3 09:22:00 2015 -0500
cleaned up and fixed all tasks including swap
commit 9f5c61e25599a130e1625e879438561cc1f6a437
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Mon Nov 2 23:38:38 2015 -0500
added new task
commit a5103ff6396138f531cf8457f16706b6fc90d1d1
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Mon Nov 2 23:38:23 2015 -0500
changing role tasks and vars
commit c776e9f339f0bcfe987aa571d29411ac44a29526
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Mon Nov 2 21:50:07 2015 -0500
updated meta
commit 46e0fd1fc2477693fc66aa4b38ac7bde19087047
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Mon Nov 2 21:23:59 2015 -0500
updated meta
commit d1d99b2f17d3bc46a479af5d01a976686429b7ce
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
Date: Mon Nov 2 21:23:03 2015 -0500
first commit
+37 -108
View File
@@ -1,86 +1,45 @@
# Role Name
# ansible-manage-lvm
An [Ansible] role to manage LVM Groups/Logical Volumes.
Ansible role to manage LVM Groups/Logical Volumes.
> NOTE: Can be used to create, extend or resize LVM Groups and volumes.
## ⚠️ Important: Ansible Galaxy Role Name
**As of December 2025**, this role is available on Ansible Galaxy as:
```yaml
- src: mrlesmithjr.manage_lvm # Note: underscore, not hyphen
```
The previous role names (`mrlesmithjr.manage-lvm` and `mrlesmithjr.manage_lvm`) were
consolidated into a single role. If you were using `mrlesmithjr.manage-lvm`, please
update your `requirements.yml` to use `mrlesmithjr.manage_lvm`.
**Note:** This role is used by [OpenStack Kayobe](https://docs.openstack.org/kayobe/latest/)
for LVM management. The `manage_lvm` name was preserved to maintain compatibility.
### Historical Download Statistics
Prior to consolidation, this role had accumulated significant usage:
| Role Name | Downloads (as of Dec 2025) |
|-----------|---------------------------|
| `mrlesmithjr.manage_lvm` | 697,492 |
| `mrlesmithjr.manage-lvm` | 494,517 |
| **Combined Total** | **1,192,009** |
Due to Ansible Galaxy limitations, download counts reset when roles are re-imported.
The historical data above represents the actual community usage of this role.
## Requirements
Devices/disks to be members of the LVM setup **must be** identified prior to
using this role.
> NOTE: Ensure that you select the correct devices/disks.
>
> NOTE: To create an LVM VG w/out creating LVM LVOLS...define lvname w/ var as
> `None` as in the below example.
## Role Variables
```yaml
---
# defaults file for ansible-manage-lvm
lvm_groups: []
# - vgname: ubuntu-vg
# disks:
# - /dev/sda5
# - /dev/sdc
# - /dev/sdd
# # defines if VG should exist or be removed
# # true or false
# create: true
# lvnames:
# - lvname: swap_1
# # Define size of lvol
# # 100%FREE, 10g, 1024 (megabytes by default)
# size: 5g
# # Defines additional lvcreate options (e.g. stripes, stripesize, etc)
# opts: ''
# # Defines if lvol should exist or be removed
# # true or false
# create: true
# # Defines filesystem to format lvol as
# filesystem: swap
# # Defines if filesystem should be mounted
# mount: false
# # Defines mountpoint for lvol
# mntp: []
# # Defines additional mount options (e.g. noatime, noexec, etc)
# mopts: ''
# - lvname: root
# size: 40g
# create: true
# filesystem: ext4
# mount: true
# mntp: /
# - vgname: test-vg
# disks:
# - /dev/sdb
# create: true
# lvnames:
# - lvname: test_1
# size: 5g
# create: true
# filesystem: ext4
# mount: true
# mntp: /mnt/test_1
# - lvname: test_2
# size: 10g
# create: true
# filesystem: ext4
# mount: true
# mntp: /mnt/test_2
# - vgname: cinder-volumes
# disks:
# - /dev/cciss/c0d1
# create: true
# lvnames:
# # Set to None to only create LVM VG w/out creating LVM LVOLS
# - None
# Defines if LVM will be managed by role
# default is false to ensure nothing is changed by accident.
manage_lvm: false
```
[defaults/main.yml](defaults/main.yml)
## Dependencies
@@ -88,48 +47,18 @@ None
## Example Playbook
```yaml
---
- hosts: test-nodes
vars:
lvm_groups:
- vgname: test-vg
disks:
- /dev/sdb
- /dev/sdc
create: true
lvnames:
- lvname: test_1
size: 5g
create: true
filesystem: ext4
mount: true
mntp: /mnt/test_1
- lvname: test_2
size: 10g
create: true
filesystem: ext4
mount: true
mntp: /mnt/test_2
manage_lvm: true
pri_domain_name: 'test.vagrant.local'
roles:
- role: ansible-manage-lvm
tasks:
```
[playbook.yml](playbook.yml)
## License
BSD
MIT
## Author Information
Larry Smith Jr.
- [@mrlesmithjr]
- <http://everythingshouldbevirtual.com>
- mrlesmithjr [at] gmail.com
- [@mrlesmithjr](https://twitter.com/mrlesmithjr)
- [mrlesmithjr@gmail.com](mailto:mrlesmithjr@gmail.com)
- [http://everythingshouldbevirtual.com](http://everythingshouldbevirtual.com)
[@mrlesmithjr]: https://www.twitter.com/mrlesmithjr
[ansible]: https://www.ansible.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>
+29
View File
@@ -9,6 +9,8 @@ lvm_groups: []
# # defines if VG should exist or be removed
# # true or false
# create: true
# # defines if PV should be resized to max size
# pvresize: false
# lvnames:
# - lvname: swap_1
# # Define size of lvol
@@ -31,6 +33,8 @@ lvm_groups: []
# size: 40g
# create: true
# filesystem: ext4
# # Defines options passed to the filesystem creation command
# fsopts:
# mount: true
# mntp: /
# - vgname: test-vg
@@ -57,7 +61,32 @@ lvm_groups: []
# lvnames:
# # Set to None to only create LVM VG w/out creating LVM LVOLS
# - None
# # Using fsopts to create a docker compatible xfs volume
# - vgname: docker-volumes
# disks:
# - /dev/vdc
# - /dev/vdd
# create: true
# lvnames:
# - lvname: docker_1
# size: 100%FREE
# create: true
# filesystem: xfs
# fsopts: -n ftype=1
# mount: true
# mntp: /var/lib/docker
# Defines if LVM will be managed by role
# default is false to ensure nothing is changed by accident.
manage_lvm: false
### nvme to scsi device name map binary helper
ebsnvme_binary_helper_ver: '0.1.3'
ebsnvme_binary_helper_tmp: '/tmp'
ebsnvme_binary_helper_path: '/sbin/go-ebsnvme'
### nvme to scsi device name map script helper
ebsnvme_scrip_helper_path: '/usr/local/bin/ebsnvme-id'
### resize all pv's to max size
pvresize_to_max: false
+10 -13
View File
@@ -1,28 +1,25 @@
---
galaxy_info:
author: Larry Smith Jr.
description: Role to manage LVM Groups/Logical Volumes. Can be used to create, extend or resize LVM.
description: Ansible role to manage(create, extend, resize) LVM Groups/Logical Volumes.
namespace: mrlesmithjr
role_name: manage-lvm
license: MIT
min_ansible_version: 1.2
min_ansible_version: "1.2"
platforms:
- name: fedora
versions:
- 31
- name: EL
versions:
- 6
- 7
- all
- name: Fedora
versions:
- all
- name: Ubuntu
versions:
- precise
- trusty
- all
- name: Debian
versions:
- jessie
- wheezy
- all
galaxy_tags:
- system
- lvm
+2 -2
View File
@@ -15,7 +15,7 @@
filesystem: ext4
mount: true
mntp: "/var/lib/mountpoint"
- lvname: my_lv2
- lvname: my_lw
size: 20%VG
opts: "--wipesignatures y"
mount: true
@@ -25,5 +25,5 @@
manage_lvm: true
tasks:
- name: "Include lvm"
include_role:
ansible.builtin.include_role:
name: "ansible-manage-lvm"
+23 -6
View File
@@ -3,15 +3,32 @@ driver:
name: vagrant
provider:
name: virtualbox
lint: yamllint . && flake8 && ansible-lint
lint: |
yamllint .
ansible-lint
flake8
platforms:
- name: Fedora-Molecule-LVM
box: fedora/31-cloud-base
cpu: 2
memory: 2048
- name: CentOS-Molecule-LVM
box: mrlesmithjr/centos7
provider_override_args:
- "persistent_storage.enabled = true"
- "persistent_storage.location = 'molecule-lvm.vdi'"
- "persistent_storage.location = 'centos-molecule-lvm.vdi'"
- "persistent_storage.size = 100"
- "persistent_storage.mount = false"
- "persistent_storage.diskdevice = '/dev/sdb'"
- name: Fedora-Molecule-LVM
box: mrlesmithjr/fedora31
provider_override_args:
- "persistent_storage.enabled = true"
- "persistent_storage.location = 'fedora-molecule-lvm.vdi'"
- "persistent_storage.size = 100"
- "persistent_storage.mount = false"
- "persistent_storage.diskdevice = '/dev/sdb'"
- name: Ubuntu-Molecule-LVM
box: mrlesmithjr/bionic64
provider_override_args:
- "persistent_storage.enabled = true"
- "persistent_storage.location = 'ubuntu-molecule-lvm.vdi'"
- "persistent_storage.size = 100"
- "persistent_storage.mount = false"
- "persistent_storage.diskdevice = '/dev/sdb'"
+1 -2
View File
@@ -16,6 +16,5 @@ def pytest_runtest_setup(item):
).get_hosts("all")
else:
pytest.skip(
"Test should run only from inside molecule.",
allow_module_level=True
"Test should run only from inside molecule.", allow_module_level=True
)
+8 -1
View File
@@ -8,7 +8,7 @@ def test_lvm_package_shall_be_installed(host):
def test_non_persistent_volume_group_is_created(host):
command = """sudo vgdisplay | grep -c 'my_vg'"""
cmd = host.run(command)
assert '1' in cmd.stdout
assert "1" in cmd.stdout
def test_mylv_logical_volume_is_created(host):
@@ -18,6 +18,13 @@ def test_mylv_logical_volume_is_created(host):
assert int(cmd.stdout.rstrip()) >= 1
def test_mylv_logical_volume2_is_created(host):
command = """sudo lvs -o lv_name my_vg --separator='|' --noheadings \
| grep -c 'my_lw'"""
cmd = host.run(command)
assert int(cmd.stdout.rstrip()) >= 1
def test_volume_is_mounted(host):
host.file("/var/lib/mountpoint").mode == 0o731
+2 -2
View File
@@ -15,7 +15,7 @@
filesystem: ext4
mount: true
mntp: "/var/lib/mountpoint"
- lvname: my_lv2
- lvname: my_lw
size: 20%VG
opts: "--wipesignatures y"
mount: true
@@ -25,5 +25,5 @@
manage_lvm: true
tasks:
- name: "Include lvm"
include_role:
ansible.builtin.include_role:
name: "ansible-manage-lvm"
-1
View File
@@ -1 +0,0 @@
../default/tests
+20
View File
@@ -0,0 +1,20 @@
"""PyTest Fixtures."""
from __future__ import absolute_import
import os
import pytest
def pytest_runtest_setup(item):
"""Run tests only when under molecule with testinfra installed."""
try:
import testinfra
except ImportError:
pytest.skip("Test requires testinfra", allow_module_level=True)
if "MOLECULE_INVENTORY_FILE" in os.environ:
pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
else:
pytest.skip(
"Test should run only from inside molecule.", allow_module_level=True
)
+33
View File
@@ -0,0 +1,33 @@
"""Role testing files using testinfra."""
def test_lvm_package_shall_be_installed(host):
assert host.package("lvm2").is_installed
def test_non_persistent_volume_group_is_created(host):
command = """sudo vgdisplay | grep -c 'my_vg'"""
cmd = host.run(command)
assert "1" in cmd.stdout
def test_mylv_logical_volume_is_created(host):
command = """sudo lvs -o lv_name my_vg --separator='|' --noheadings \
| grep -c 'my_lv'"""
cmd = host.run(command)
assert int(cmd.stdout.rstrip()) >= 1
def test_mylv_logical_volume2_is_created(host):
command = """sudo lvs -o lv_name my_vg --separator='|' --noheadings \
| grep -c 'my_lw'"""
cmd = host.run(command)
assert int(cmd.stdout.rstrip()) >= 1
def test_volume_is_mounted(host):
host.file("/var/lib/mountpoint").mode == 0o731
def test_volume2_is_mounted(host):
host.file("/var/lib/mountpoint2").mode == 0o731
+14
View File
@@ -0,0 +1,14 @@
---
- name: Converge
hosts: all
vars:
lvm_groups:
- vgname: my_vg
disks:
- /dev/vdb
create: true
manage_lvm: true
tasks:
- name: "Include lvm"
ansible.builtin.include_role:
name: "ansible-manage-lvm"
+29
View File
@@ -0,0 +1,29 @@
---
driver:
name: vagrant
provider:
name: libvirt
lint: yamllint . && flake8 && ansible-lint
platforms:
- name: Fedora-Molecule-Volumes-KVM
box: fedora/31-cloud-base
cpu: 2
memory: 2048
provider_raw_config_args:
- "storage :file, :size => '1G', :device => 'vdb'"
provisioner:
name: ansible
config_options:
defaults:
forks: 20
ssh_connection:
pipelining: true
ssh_args: -o ControlMaster=auto -o ControlPersist=600s
verifier:
name: testinfra
env:
PYTHONWARNINGS: "ignore:.*U.*mode is deprecated:DeprecationWarning"
options:
v: 1
scenario:
name: kvmonlyvg
+20
View File
@@ -0,0 +1,20 @@
"""PyTest Fixtures."""
from __future__ import absolute_import
import os
import pytest
def pytest_runtest_setup(item):
"""Run tests only when under molecule with testinfra installed."""
try:
import testinfra
except ImportError:
pytest.skip("Test requires testinfra", allow_module_level=True)
if "MOLECULE_INVENTORY_FILE" in os.environ:
pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
else:
pytest.skip(
"Test should run only from inside molecule.", allow_module_level=True
)
+11
View File
@@ -0,0 +1,11 @@
"""Role testing files using testinfra."""
def test_lvm_package_shall_be_installed(host):
assert host.package("lvm2").is_installed
def test_non_persistent_volume_group_is_created(host):
command = """sudo vgdisplay | grep -c 'my_vg'"""
cmd = host.run(command)
assert "1" in cmd.stdout
+22
View File
@@ -0,0 +1,22 @@
---
- name: Converge
hosts: all
vars:
lvm_groups:
- vgname: my_vg
disks:
- /dev/vdb
create: true
lvnames:
- lvname: my_lv
size: 40%VG
opts: "--wipesignatures y"
create: true
filesystem: ext4
mount: true
mntp: "/var/lib/mountpoint"
manage_lvm: true
tasks:
- name: "Include lvm"
ansible.builtin.include_role:
name: "ansible-manage-lvm"
+29
View File
@@ -0,0 +1,29 @@
---
driver:
name: vagrant
provider:
name: libvirt
lint: yamllint . && flake8 && ansible-lint
platforms:
- name: Fedora-Molecule-Volumes-KVM
box: fedora/31-cloud-base
cpu: 2
memory: 2048
provider_raw_config_args:
- "storage :file, :size => '1G', :device => 'vdb'"
provisioner:
name: ansible
config_options:
defaults:
forks: 20
ssh_connection:
pipelining: true
ssh_args: -o ControlMaster=auto -o ControlPersist=600s
verifier:
name: testinfra
env:
PYTHONWARNINGS: "ignore:.*U.*mode is deprecated:DeprecationWarning"
options:
v: 1
scenario:
name: kvmsinglelv
+20
View File
@@ -0,0 +1,20 @@
"""PyTest Fixtures."""
from __future__ import absolute_import
import os
import pytest
def pytest_runtest_setup(item):
"""Run tests only when under molecule with testinfra installed."""
try:
import testinfra
except ImportError:
pytest.skip("Test requires testinfra", allow_module_level=True)
if "MOLECULE_INVENTORY_FILE" in os.environ:
pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
else:
pytest.skip(
"Test should run only from inside molecule.", allow_module_level=True
)
@@ -0,0 +1,22 @@
"""Role testing files using testinfra."""
def test_lvm_package_shall_be_installed(host):
assert host.package("lvm2").is_installed
def test_non_persistent_volume_group_is_created(host):
command = """sudo vgdisplay | grep -c 'my_vg'"""
cmd = host.run(command)
assert "1" in cmd.stdout
def test_mylv_logical_volume_is_created(host):
command = """sudo lvs -o lv_name my_vg --separator='|' --noheadings \
| grep -c 'my_lv'"""
cmd = host.run(command)
assert int(cmd.stdout.rstrip()) >= 1
def test_volume_is_mounted(host):
host.file("/var/lib/mountpoint").mode == 0o731
+28
View File
@@ -0,0 +1,28 @@
---
- name: Example playbook
hosts: test-nodes
vars:
lvm_groups:
- vgname: test-vg
disks:
- /dev/sdb
- /dev/sdc
create: true
lvnames:
- lvname: test_1
size: 5g
create: true
filesystem: ext4
mount: true
mntp: /mnt/test_1
- lvname: test_2
size: 10g
create: true
filesystem: ext4
mount: true
mntp: /mnt/test_2
manage_lvm: true
tasks:
- name: Include lvm
ansible.builtin.include_role:
name: ansible-manage-lvm
Generated
+2463
View File
File diff suppressed because it is too large Load Diff
+23
View File
@@ -0,0 +1,23 @@
[tool.poetry]
name = "ansible-manage-lvm"
version = "0.1.0"
description = ""
authors = ["Larry Smith Jr. <mrlesmithjr@gmail.com>"]
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
ansible = "8.5.0"
[tool.poetry.group.dev.dependencies]
ansible-lint = "6.8.7"
black = "^22.10.0"
pylint = "^2.15.7"
flake8 = "^6.0.0"
cookiecutter = "^2.1.1"
pre-commit = "^2.20.0"
molecule-plugins = {extras = ["vagrant"], version = "^23.4.1"}
molecule = {extras = ["docker"], version = "^5.0.1"}
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
+4
View File
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>mrlesmithjr/renovate-config"]
}
+70 -66
View File
@@ -1,66 +1,70 @@
ansible==2.9.7
ansible-lint==4.2.0
arrow==0.15.5
attrs==19.3.0
bcrypt==3.1.7
binaryornot==0.4.4
Cerberus==1.3.2
certifi==2020.4.5.1
cffi==1.14.0
chardet==3.0.4
click==7.1.1
click-completion==0.5.2
click-help-colors==0.8
colorama==0.4.3
cookiecutter==1.7.0
cryptography==2.9
distro==1.5.0
docker==4.2.0
entrypoints==0.3
fasteners==0.15
flake8==3.7.9
future==0.18.2
idna==2.9
importlib-metadata==1.6.0
Jinja2==2.11.2
jinja2-time==0.2.0
MarkupSafe==1.1.1
mccabe==0.6.1
molecule==3.0.3
molecule-vagrant==0.2
monotonic==1.5
more-itertools==8.2.0
packaging==20.3
paramiko==2.7.1
pathspec==0.8.0
pexpect==4.8.0
pluggy==0.13.1
poyo==0.5.0
ptyprocess==0.6.0
py==1.8.1
pycodestyle==2.5.0
pycparser==2.20
pyflakes==2.1.1
PyNaCl==1.3.0
pyparsing==2.4.7
pytest==5.4.1
python-dateutil==2.8.1
python-gilt==1.2.3
python-vagrant==0.5.15
PyYAML==5.3.1
requests==2.23.0
ruamel.yaml==0.16.10
ruamel.yaml.clib==0.2.0
selinux==0.2.1
sh==1.12.14
shellingham==1.3.2
six==1.14.0
tabulate==0.8.7
testinfra==5.0.0
tree-format==0.1.2
urllib3==1.25.9
wcwidth==0.1.9
websocket-client==0.57.0
whichcraft==0.6.1
yamllint==1.23.0
zipp==3.1.0
ansible-compat==24.10.0
ansible-core==2.15.13
ansible-lint==6.8.7
arrow==1.4.0
astroid==2.15.8
attrs==26.1.0
binaryornot==0.6.0
black==22.12.0
bracex==2.6
certifi==2026.2.25
cffi==2.0.0
cfgv==3.5.0
charset-normalizer==3.4.6
click==8.3.1
click-help-colors==0.9.4
cookiecutter==2.7.1
cryptography==46.0.5
dill==0.4.1
distlib==0.4.0
enrich==1.2.7
filelock==3.25.2
flake8==6.1.0
identify==2.6.18
idna==3.11
isort==5.13.2
jinja2==3.1.6
jsonschema==4.26.0
jsonschema-specifications==2025.9.1
lazy-object-proxy==1.12.0
markdown-it-py==4.0.0
markupsafe==3.0.3
mccabe==0.7.0
mdurl==0.1.2
molecule==5.1.0
molecule-plugins==23.5.0
mypy-extensions==1.1.0
nodeenv==1.10.0
packaging==26.0
pathspec==1.0.4
platformdirs==4.9.4
pluggy==1.6.0
pre-commit==2.21.0
pycodestyle==2.11.1
pycparser==3.0
pyflakes==3.1.0
pygments==2.19.2
pylint==2.17.7
python-dateutil==2.9.0.post0
python-discovery==1.2.0
python-slugify==8.0.4
python-vagrant==1.0.0
pyyaml==6.0.3
referencing==0.37.0
requests==2.33.0
resolvelib==1.0.1
rich==14.3.3
rpds-py==0.30.0
ruamel-yaml==0.17.40
ruamel-yaml-clib==0.2.15
six==1.17.0
subprocess-tee==0.4.2
text-unidecode==1.3
tomlkit==0.14.0
typing-extensions==4.15.0
tzdata==2025.3
urllib3==2.6.3
virtualenv==21.2.0
wcmatch==10.1
wrapt==1.17.3
yamllint==1.38.0
+10 -7
View File
@@ -1,7 +1,10 @@
ansible-lint==4.2.0
docker==4.2.0
flake8==3.7.9
molecule-vagrant==0.2
molecule==3.0.3
testinfra==5.0.0
yamllint==1.23.0
ansible==8.5.0
ansible-core==2.15.13
cffi==2.0.0
cryptography==46.0.5
jinja2==3.1.6
markupsafe==3.0.3
packaging==26.0
pycparser==3.0
pyyaml==6.0.3
resolvelib==1.0.1
-17
View File
@@ -1,17 +0,0 @@
#!/usr/bin/env bash
TAR_FILE="v1.6.0.tar.gz"
# Prompt for Ansible role name
read -p "Enter the Ansible role name: " input
# Update .travis.yml with Ansible role name
sed -i '' "s/replace_role/${input}/g" ".travis.yml"
# Update tests/test.yml with Ansible role name
sed -i '' "s/replace_role/${input}/g" "tests/test.yml"
# Cleanup
if [ -f $TAR_FILE ]; then
rm $TAR_FILE
fi
+70
View File
@@ -0,0 +1,70 @@
---
- name: amazon | check for nvme devices
ansible.builtin.shell: |
set -o pipefail
cat /proc/partitions | awk '{print $4}' | grep -q nvme. ; echo $?
args:
executable: /bin/bash
register: blkdev_nvme
changed_when: false
- name: amazon | check for amazon ebs devices
ansible.builtin.shell: |
set -o pipefail
lsblk -O -J | grep -qi "amazon elastic block store" ; echo $?
register: blkdev_awsebs
changed_when: false
args:
executable: /bin/bash
- name: amazon | set flag for nvme subsystem
ansible.builtin.set_fact:
device_is_nvme: "{{ true if (blkdev_nvme.stdout == '0') else false }}"
- name: amazon | set flag for aws ebs devices
ansible.builtin.set_fact:
device_is_awsebs: "{{ true if (blkdev_awsebs.stdout == '0') else false }}"
- name: Block to map renamed ec2 ebs nvmeXnY devices to their original sdX/xvdX names
when: device_is_nvme and device_is_awsebs|bool
become: true
block:
- name: amazon | download nvme mapping binary helper
ansible.builtin.get_url:
url: "{{ ebsnvme_binary_helper_url }}"
dest: "{{ ebsnvme_binary_helper_tmp }}/"
mode: u=rw,g=r,o=r
changed_when: false
- name: amazon | extract binary helper
ansible.builtin.unarchive:
src: "{{ ebsnvme_binary_helper_tmp }}/{{ ebsnvme_binary_helper_file }}"
dest: "{{ ebsnvme_binary_helper_tmp }}/"
remote_src: yes
mode: 0755
changed_when: false
- name: amazon | copy binary helper
ansible.builtin.copy:
src: "{{ ebsnvme_binary_helper_tmp }}/go-ebsnvme"
dest: "{{ ebsnvme_binary_helper_path }}"
mode: a+x
remote_src: yes
- name: amazon | template script helper
ansible.builtin.template:
src: "ebsnvme-id.j2"
dest: "{{ ebsnvme_scrip_helper_path }}"
mode: a+x
- name: amazon | template udev rule
ansible.builtin.template:
src: "70-ec2-nvme-devices.rules.j2"
dest: "/etc/udev/rules.d/70-ec2-nvme-devices.rules"
mode: 0755
register: udev_rule
- name: amazon | reload and trigger udev rules # noqa no-changed-when no-handler
ansible.builtin.shell:
cmd: udevadm control --reload-rules && udevadm trigger
when: udev_rule.changed
+52 -36
View File
@@ -1,54 +1,70 @@
---
- name: centos | installing lvm2
package:
name: "lvm2"
state: "present"
- name: centos | installing lvm2 and sg3_utils
ansible.builtin.package:
name:
- lvm2
- sg3_utils
state: present
become: true
- name: centos | installing sg3_utils
package:
name: "sg3_utils"
state: "present"
become: true
- name: Specific tasks for Amazon EC2
ansible.builtin.include_tasks: amazon.yml
when: ansible_facts.system_vendor == 'Amazon EC2'
- name: "debug lvg"
debug:
- name: centos | debug lvg
ansible.builtin.debug:
var: lv
verbosity: 3
loop: "{{ lookup('subelements', lvm_groups, 'lvnames', {'skip_missing': True}) }}"
loop: "{{ lookup('subelements', lvm_groups, 'lvnames', {'skip_missing': True}, wantlist=True) }}"
loop_control:
loop_var: lv
- name: centos | install xfs tools
package:
ansible.builtin.package:
name: "xfsprogs"
state: "present"
become: true
loop: "{{ lookup('subelements', lvm_groups, 'lvnames', {'skip_missing': True}) }}"
loop: "{{ lookup('subelements', lvm_groups, 'lvnames', {'skip_missing': True}, wantlist=True) }}"
loop_control:
loop_var: lv
when: >
(
(lv.1 is defined and lv.1 != 'None') and
(
lv.1.filesystem is defined and
lv.1.filesystem == "xfs"
)
and
(
lv.1.create is defined and
lv.1.create
)
)
when:
- lv.1 is defined
- lv.1 != "None"
- lv.1.filesystem is defined
- lv.1.filesystem == "xfs"
- lv.1.create is defined
- lv.1.create|bool
- name: centos | checking for scsi devices
command: "sg_scan"
- name: centos | check for scsi adapters
ansible.builtin.find:
paths: "/sys/class/scsi_host"
file_type: any
become: true
register: "scsi_devices"
changed_when: false
register: scsi_adapters
- name: centos | rescanning for new disks
command: "/usr/bin/rescan-scsi-bus.sh"
become: true
changed_when: false
- name: centos | Check for new disks
when: scsi_adapters.matched > 0
block:
- name: centos | installing sg3_utils
ansible.builtin.package:
name: sg3_utils
state: present
become: true
- name: centos | checking for scsi devices
ansible.builtin.command: sg_scan
become: true
register: scsi_devices
changed_when: false
- name: centos | rescanning for new disks
ansible.builtin.command: "{{ rescan_scsi_command }}"
become: true
changed_when: false
when: scsi_devices.stdout|length > 0
- name: centos | rescanning for resized disks
ansible.builtin.command: "{{ rescan_scsi_command }} -s"
become: true
changed_when: false
when: scsi_devices.stdout|length > 0
+77 -90
View File
@@ -1,110 +1,97 @@
---
- name: manage_lvm | unmounting filesystem(s)
mount:
# unable to resize xfs: looks like we've to reference the mountpoint instead of the device
- name: create_fs | check already converted
# at least xfs is executed twice if the partition has changed in the meantime
# then it tries to recreate the fs on the mounted fs which indeed fails...
ansible.builtin.shell: "xfs_info {{ lv.mntp }} | grep -c 'ftype=1'"
become: true
register: mountedxfs
ignore_errors: true
changed_when: false
when:
- lv is defined and lv != 'None'
- lv.filesystem is defined
- lv.filesystem == "xfs"
- lv.create is defined
- lv.create|bool
- name: create_fs | unmounting filesystem(s)
ansible.posix.mount:
path: "{{ lv.mntp }}"
src: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
fstype: "{{ lv.filesystem | default(omit) }}"
state: "absent"
state: absent
become: true
loop: "{{ vg.lvnames }}"
loop_control:
loop_var: lv
when: >
(lv is defined and
lv != 'None') and
(lv.create is defined and
not lv.create and
lv.filesystem != "swap")
when:
- lv is defined
- lv != 'None'
- lv.create is defined
- not lv.create|bool
- lv.filesystem != "swap"
- name: manage_lvm | creating new filesystem on new LVM logical volume(s)
filesystem:
- name: create_fs | creating new filesystem on new LVM logical volume(s)
community.general.filesystem:
fstype: "{{ lv.filesystem }}"
dev: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
resizefs: yes
loop: "{{ vg.lvnames }}"
loop_control:
loop_var: lv
become: true
when: >
(
(vg.create is defined and
vg.create) and
(lv is defined and
lv != 'None') and
(lv.create is defined and
lv.create) and
(
lv.filesystem is defined and
lv.filesystem != 'None' and
lv.filesystem != 'xfs'
)
)
# unable to resize xfs: looks like we've to reference the mountpoint instead of the device
when:
- vg.create is defined
- vg.create|bool
- lv is defined
- lv != 'None'
- lv.create is defined
- lv.create|bool
- lv.filesystem is defined
- lv.filesystem != 'None'
- lv.filesystem != 'swap'
- lv.filesystem != 'xfs'
- name: lvm | check already converted
# at least xfs is executed twice if the partition has changed in the meantime
# then it tries to recreate the fs on the mounted fs which indeed fails...
shell: "xfs_info {{ lv.mntp }} | grep -c 'ftype=1'"
become: yes
loop: "{{ vg.lvnames }}"
loop_control:
loop_var: lv
register: mountedxfs
ignore_errors: true
changed_when: no
when: >
(
(lv is defined and lv != 'None') and
(
lv.filesystem is defined and
lv.filesystem == "xfs"
)
and
(
lv.create is defined and
lv.create
)
)
- name: manage_lvm | creating new xfs filesystem on new LVM logical volume(s)
filesystem:
- name: create_fs | creating new xfs filesystem on new LVM logical volume(s)
community.general.filesystem:
fstype: "{{ lv.filesystem }}"
dev: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
loop: "{{ vg.lvnames }}"
loop_control:
loop_var: lv
opts: "{{ lv.fsopts | default(omit) }}"
become: true
when: >
(
mountedxfs is failed and
(vg.create is defined and
vg.create) and
(lv is defined and
lv != 'None') and
(lv.create is defined and
lv.create) and
(
lv.filesystem is defined and
lv.filesystem == 'xfs'
)
)
when:
- mountedxfs is failed
- vg.create is defined
- vg.create|bool
- lv is defined
- lv != 'None'
- lv.create is defined
- lv.create|bool
- lv.filesystem is defined
- lv.filesystem == 'xfs'
- name: manage_lvm | mounting new filesystem(s)
mount:
- name: create_fs | mounting new filesystem(s)
ansible.posix.mount:
path: "{{ lv.mntp }}"
src: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
fstype: "{{ lv.filesystem }}"
state: "mounted"
state: mounted
opts: "{{ lv.mopts | default('defaults') }}"
become: true
loop: "{{ vg.lvnames }}"
loop_control:
loop_var: lv
when: >
((vg.create is defined and
vg.create) and
lv != 'None' and
(lv.create is defined and
lv.create) and
(lv.mount is defined and
lv.mount))
when:
- vg.create is defined
- vg.create|bool
- lv is defined
- lv != 'None'
- lv.create is defined
- lv.create|bool
- lv.mount is defined
- lv.mount|bool
- name: create_fs | resizing xfs filesystem on new LVM logical volume(s) # noqa no-changed-when
ansible.builtin.command: "xfs_growfs {{ lv.mntp }}"
become: true
when:
- vg.create is defined
- vg.create|bool
- lv is defined
- lv != 'None'
- lv.create is defined
- lv.create|bool
- lv.filesystem is defined
- lv.filesystem == 'xfs'
- lvchanged.changed
+21 -26
View File
@@ -1,35 +1,30 @@
---
- name: "debug vg"
debug:
- name: create_lv | Display Volume Group
ansible.builtin.debug:
var: vg
verbosity: 2
- name: "debug lvm"
loop: "{{ vg.lvnames }}"
debug:
var: lv
verbosity: 1
loop_control:
loop_var: lv
- name: manage_lvm | creating new LVM logical volume(s)
lvol:
- name: create_lv | creating new LVM logical volume(s)
community.general.lvol:
vg: "{{ vg.vgname }}"
lv: "{{ lv.lvname }}"
size: "{{ lv.size }}"
shrink: no
shrink: false
opts: "{{ lv.opts | default('') }}"
state: "present"
loop: "{{ vg.lvnames }}"
loop_control:
loop_var: lv
state: present
become: true
when: >
(
(vg.create is defined
and vg.create) and
(lv is defined and
lv != 'None') and
(lv.create is defined and
lv.create)
)
register: lvchanged
when:
- vg.create is defined
- vg.create|bool
- lv is defined
- lv != 'None'
- lv.create is defined
- lv.create|bool
- name: create_lv | debug changed attribute
ansible.builtin.debug:
var: lvchanged
- name: create_lv | configuring FS
ansible.builtin.include_tasks: create_fs.yml
+15 -10
View File
@@ -1,12 +1,17 @@
---
- name: manage_lvm | creating new LVM volume group(s)
lvg:
vg: "{{ item.vgname }}"
pvs: "{{ item.disks | join(',') }}"
state: "present"
- name: create_vg | creating new LVM volume group(s)
community.general.lvg:
vg: "{{ vg.vgname }}"
pvs: "{{ vg.disks | join(',') }}"
state: present
pvresize: "{{ vg.pvresize | default(pvresize_to_max) }}"
become: true
loop: "{{ lvm_groups }}"
when: >
item.create is defined and
item.create
when:
- vg.create is defined
- vg.create|bool
- name: manage_lvm | loop over logical volume group(s) to create logical volumes
ansible.builtin.include_tasks: create_lv.yml
loop: "{{ vg.lvnames | default([]) }}"
loop_control:
loop_var: lv
+24 -24
View File
@@ -1,40 +1,40 @@
---
- name: debian | Updating Apt Cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
become: true
- name: debian | installing pre-reqs
package:
ansible.builtin.apt:
name:
- lvm2
- scsitools
state: "present"
state: present
become: true
- name: debian | install xfs tools
package:
name: "xfsprogs"
state: "present"
become: yes
loop: "{{ lvm_groups|subelements('lvnames') }}"
when: >
(
(item.1 is defined and item.1 != 'None') and
(
item.1.filesystem is defined and
item.1.filesystem == "xfs"
)
and
(
item.1.create is defined and
item.1.create
)
)
ansible.builtin.apt:
name: xfsprogs
state: present
become: true
loop: "{{ lvm_groups | subelements('lvnames') }}"
when:
- item.1 is defined
- item.1 != 'None'
- item.1.filesystem is defined
- item.1.filesystem == "xfs"
- item.1.create is defined
- item.1.create|bool
- name: debian | checking for scsi devices
command: "sg_scan"
ansible.builtin.command: sg_scan
become: true
register: "scsi_devices"
register: scsi_devices
changed_when: false
- name: debian | rescanning for new disks added
command: "/sbin/rescan-scsi-bus"
ansible.builtin.command: "{{ rescan_scsi_command }}"
become: true
changed_when: false
when: scsi_devices['stdout'] | length
when: scsi_devices['stdout'] | length > 0
+19 -8
View File
@@ -1,12 +1,23 @@
---
# tasks file for ansible-manage-lvm
- include_tasks: debian.yml
when: ansible_os_family == "Debian"
- name: Set rescan_scsi_command for old debian version
ansible.builtin.set_fact:
rescan_scsi_command: "/sbin/rescan-scsi-bus"
when:
- ansible_facts.distribution | replace(' ','') | lower == 'debian'
- ansible_facts.distribution_release not in ('bookworm', 'sid')
- ansible_facts.distribution_major_version is version(10, '<=')
- include_tasks: centos.yml
when: ansible_os_family == "RedHat"
- name: Debian specific tasks
ansible.builtin.include_tasks: debian.yml
when: ansible_facts.os_family == "Debian"
- include_tasks: manage_lvm.yml
when: >
manage_lvm and
lvm_groups is defined
- name: RHEL specific tasks
ansible.builtin.include_tasks: centos.yml
when: ansible_facts.os_family == "RedHat"
- name: Manage LVM
ansible.builtin.include_tasks: manage_lvm.yml
when:
- lvm_groups is defined
- manage_lvm|bool
+15 -24
View File
@@ -1,40 +1,31 @@
---
- name: manage_lvm | manage physical volume group creation
include_tasks: create_vg.yml
- name: manage_lvm | loop over logical volume group(s) to create logical volumes
include_tasks: create_lv.yml
loop: "{{ lvm_groups }}"
loop_control:
loop_var: vg
- name: manage_lvm | loop over logical volume group(s) to create filesystems
include_tasks: create_fs.yml
ansible.builtin.include_tasks: create_vg.yml
loop: "{{ lvm_groups }}"
loop_control:
loop_var: vg
- name: manage_lvm | Removing LVM logical volume(s)
lvol:
community.general.lvol:
vg: "{{ item.0.vgname }}"
lv: "{{ item.1.lvname }}"
state: "absent"
force: yes
state: absent
force: true
become: true
loop: "{{ lvm_groups|subelements('lvnames') }}"
when: >
(item.1 is defined and
item.1 != 'None') and
(item.1.create is defined and
not item.1.create)
loop: "{{ lvm_groups | subelements('lvnames', {'skip_missing': true}) }}"
when:
- item.1 is defined
- item.1 != 'None'
- item.1.create is defined
- not item.1.create|bool
- name: manage_lvm | Removing LVM volume group(s)
lvg:
community.general.lvg:
vg: "{{ item.vgname }}"
pvs: "{{ item.disks | join(',') }}"
state: "absent"
state: absent
become: true
loop: "{{ lvm_groups }}"
when: >
item.create is defined and
not item.create
when:
- item.create is defined
- not item.create|bool
+2
View File
@@ -0,0 +1,2 @@
# ebs nvme to scsi device naming mapping
KERNEL=="nvme[0-9]*n[0-9]*", ENV{DEVTYPE}=="disk", ATTRS{model}=="Amazon Elastic Block Store", PROGRAM="{{ ebsnvme_scrip_helper_path }} /dev/%k", SYMLINK+="%c"
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# This script uses go version of ebsnvme-id to provide
# SCSI Disk device name links for nvme devices
#
# links:
#
# https://www.logicworks.com/blog/2018/03/manage-aws-ebs-volumes-c5-m5-puppet-chef-ansible/
# https://github.com/mvisonneau/go-ebsnvme
# https://gist.github.com/lbernail/d851e5b06eb32180a4b8ead2ce4f45db
# and working forks like:
# (keenan-v1/ebsnvme-id) https://gist.github.com/keenan-v1/aee92cd7383ee02de2a817a004917a03
#
{{ ebsnvme_binary_helper_path }} -n $1 | awk -F '/' '{print $3}'
+1 -1
View File
@@ -1 +1 @@
skip_list: ['305','503','602']
skip_list: ['305', '503', '602']
+5 -4
View File
@@ -1,5 +1,6 @@
---
- hosts: localhost
connection: local
roles:
- ansible-manage-lvm
# - name: Test role
# hosts: localhost
# connection: local
# roles:
# - role: ansible-manage-lvm
+5
View File
@@ -1,2 +1,7 @@
---
# vars file for ansible-manage-lvm
ebsnvme_binary_helper_file: go-ebsnvme_{{ ebsnvme_binary_helper_ver }}_linux_amd64.tar.gz
ebsnvme_binary_helper_url: https://github.com/mvisonneau/go-ebsnvme/releases/download/{{ ebsnvme_binary_helper_ver }}/{{ ebsnvme_binary_helper_file }}
rescan_scsi_command: "/usr/bin/rescan-scsi-bus.sh"