mirror of
https://github.com/mrlesmithjr/ansible-manage-lvm.git
synced 2026-09-02 21:50:36 +03:00
Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 24e97867c9 | |||
| 5b36f4779f | |||
| 164b50b083 | |||
| 7328da933e | |||
| af9951c5cd | |||
| 454649d90b | |||
| 12f7033566 | |||
| 9a5d1dfc15 | |||
| 2f56dc54ad | |||
| 9f6bac5d63 | |||
| 9ffff49ef8 | |||
| 113974cccc | |||
| 2c41273c9f | |||
| 6d0feecec7 | |||
| 416e840eea | |||
| 850d571313 | |||
| ff13947aaf | |||
| 26246c7160 | |||
| 5540f7fda5 | |||
| 433b7ca1a9 | |||
| 9404a780c5 | |||
| c0184492d5 | |||
| 60e08852ea | |||
| 42cc915582 | |||
| 49edca9134 | |||
| ee1e3d051b | |||
| 91f8cfca5d | |||
| 3ac9669088 | |||
| 4219da5423 | |||
| 683c617265 | |||
| b41ffc5e58 | |||
| 564d3d1f6f | |||
| 1d0fa70d66 | |||
| 8c3bca39ec | |||
| 4fbcf1cd19 | |||
| 11056e2e60 | |||
| 220de2d8ac | |||
| 3f3a7c7334 | |||
| f901fe42b3 | |||
| d27a3809d9 | |||
| 51b7015f9c | |||
| e35a250f7b | |||
| de0507269b | |||
| 1b7e7e6b1c | |||
| 84ba07bcaf | |||
| a623248cdf | |||
| 55b1745ac3 | |||
| c020c6ef2d | |||
| 47c980797d | |||
| d6dd5184f0 | |||
| 74e7ca5652 | |||
| 12346fa038 | |||
| 8dc044f7c2 | |||
| aa66814872 | |||
| 6e4f217d74 | |||
| 483ed18874 | |||
| ea2e60f043 | |||
| a28791cc48 | |||
| b5bf2d266c | |||
| ca903442c8 | |||
| 9e69c74f71 | |||
| e9ff7e3faf | |||
| 84bfdf54ad | |||
| 376f2ce641 | |||
| 6e74c9714e | |||
| 1f966d2ea1 | |||
| 71a3930e5b | |||
| 263c8d2b3f | |||
| 0bfd390ace | |||
| 71bc56d733 | |||
| 59ca2aae95 | |||
| cb3a75c984 | |||
| fae4332de8 | |||
| 3ea52cdda8 | |||
| 2d020f26d8 | |||
| 558cd7460e | |||
| 3b00335935 | |||
| ac014a161e | |||
| 9446ef21d6 | |||
| 97300430ad |
@@ -0,0 +1,3 @@
|
|||||||
|
skip_list:
|
||||||
|
- name[casing]
|
||||||
|
- role-name
|
||||||
@@ -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"
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
- uses: actions/cache@v5
|
||||||
|
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: Check linting with pre-commit
|
||||||
|
run: pre-commit run --all-files
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
# 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:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- 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
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
# 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
|
|
||||||
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
|
|
||||||
@@ -12,6 +12,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Drafts your next Release notes as Pull Requests are merged into "master"
|
# Drafts your next Release notes as Pull Requests are merged into "master"
|
||||||
- uses: release-drafter/release-drafter@v5
|
- uses: release-drafter/release-drafter@v7
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
name: Ansible Galaxy
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
galaxy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install Ansible
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install ansible-core
|
||||||
|
|
||||||
|
- 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
-1
@@ -1,3 +1,3 @@
|
|||||||
.idea
|
.idea
|
||||||
**/__pycache__
|
**/__pycache__
|
||||||
venv/
|
.venv/
|
||||||
|
|||||||
@@ -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
|
||||||
-32
@@ -1,32 +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
|
|
||||||
sudo molecule test --scenario-name kvmsinglelv
|
|
||||||
sudo molecule test --scenario-name kvmonlyvg
|
|
||||||
notifications:
|
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
extends: default
|
extends: default
|
||||||
|
|
||||||
ignore: |
|
ignore: |
|
||||||
venv/
|
.venv/
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
braces:
|
braces:
|
||||||
|
|||||||
-322
@@ -1,322 +0,0 @@
|
|||||||
commit 881d5d77fa435ccaa026c3341d0d2ac1fb537b98
|
|
||||||
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
|
|
||||||
Date: Mon Apr 27 11:26:18 2020 -0400
|
|
||||||
|
|
||||||
Fixing syntax issue for wantlist
|
|
||||||
|
|
||||||
commit 89360e3ffef9ff1dbbb5ad525a7ee1d77e6b8895
|
|
||||||
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
|
|
||||||
Date: Mon Apr 27 11:16:02 2020 -0400
|
|
||||||
|
|
||||||
Trying to fix the subelements lookup for a single element
|
|
||||||
|
|
||||||
This addresses #42. Will need to do some validation testing, etc.
|
|
||||||
|
|
||||||
commit c6a7034e4b0b381c5c5b44a15ce7baad7eab9c1b
|
|
||||||
Author: Charlie Mordant <cmordant1@gmail.com>
|
|
||||||
Date: Fri Apr 24 17:22:07 2020 +0200
|
|
||||||
|
|
||||||
remove unused molecule env property
|
|
||||||
|
|
||||||
commit 883055c33f2d6b4c0df8e61ce49771c451905334
|
|
||||||
Author: Charlie Mordant <cmordant1@gmail.com>
|
|
||||||
Date: Thu Apr 23 19:38:35 2020 +0200
|
|
||||||
|
|
||||||
lint
|
|
||||||
|
|
||||||
commit 325c2d6240022fe17abf40dffee842ccf79543f1
|
|
||||||
Author: Charlie Mordant <cmordant1@gmail.com>
|
|
||||||
Date: Thu Apr 23 19:25:09 2020 +0200
|
|
||||||
|
|
||||||
install xfs
|
|
||||||
|
|
||||||
commit 4a1177e420fd9632f77d07ce0a19f89a1515f8eb
|
|
||||||
Author: Charlie Mordant <cmordant1@gmail.com>
|
|
||||||
Date: Tue Apr 21 19:01:29 2020 +0200
|
|
||||||
|
|
||||||
use xfs_info on mountpoint instead of lvm
|
|
||||||
|
|
||||||
commit 7fd5a8eec9f4b5110929862056ab88c4db3f14de
|
|
||||||
Author: Larry Smith Jr <mrlesmithjr@gmail.com>
|
|
||||||
Date: Sun Apr 19 01:59:29 2020 -0400
|
|
||||||
|
|
||||||
Only doing a Molecule lint at this time
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,34 +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.
|
||||||
|
|
||||||
|
## Ansible Galaxy
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-galaxy install mrlesmithjr.manage_lvm
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note:** As of December 2025, the canonical Galaxy name is `mrlesmithjr.manage_lvm` (underscore).
|
||||||
|
> Update any `requirements.yml` using the older hyphen-style name `mrlesmithjr.manage-lvm`.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Historical download statistics</summary>
|
||||||
|
|
||||||
|
| Role Name | Downloads (as of Dec 2025) |
|
||||||
|
|-----------|---------------------------|
|
||||||
|
| `mrlesmithjr.manage_lvm` | 697,492 |
|
||||||
|
| `mrlesmithjr.manage-lvm` | 494,517 |
|
||||||
|
| **Combined** | **1,192,009** |
|
||||||
|
|
||||||
|
Download counts reset when roles are re-imported to Galaxy. These figures represent actual historical usage.
|
||||||
|
</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)
|
Larry Smith Jr. — [everythingshouldbevirtual.com](http://everythingshouldbevirtual.com) · [mrlesmithjr@gmail.com](mailto:mrlesmithjr@gmail.com)
|
||||||
|
|||||||
+19
-4
@@ -9,6 +9,8 @@ lvm_groups: []
|
|||||||
# # defines if VG should exist or be removed
|
# # defines if VG should exist or be removed
|
||||||
# # true or false
|
# # true or false
|
||||||
# create: true
|
# create: true
|
||||||
|
# # defines if PV should be resized to max size
|
||||||
|
# pvresize: false
|
||||||
# lvnames:
|
# lvnames:
|
||||||
# - lvname: swap_1
|
# - lvname: swap_1
|
||||||
# # Define size of lvol
|
# # Define size of lvol
|
||||||
@@ -31,6 +33,8 @@ lvm_groups: []
|
|||||||
# size: 40g
|
# size: 40g
|
||||||
# create: true
|
# create: true
|
||||||
# filesystem: ext4
|
# filesystem: ext4
|
||||||
|
# # Defines options passed to the filesystem creation command
|
||||||
|
# fsopts:
|
||||||
# mount: true
|
# mount: true
|
||||||
# mntp: /
|
# mntp: /
|
||||||
# - vgname: test-vg
|
# - vgname: test-vg
|
||||||
@@ -57,6 +61,20 @@ lvm_groups: []
|
|||||||
# lvnames:
|
# lvnames:
|
||||||
# # Set to None to only create LVM VG w/out creating LVM LVOLS
|
# # Set to None to only create LVM VG w/out creating LVM LVOLS
|
||||||
# - None
|
# - 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
|
# Defines if LVM will be managed by role
|
||||||
# default is false to ensure nothing is changed by accident.
|
# default is false to ensure nothing is changed by accident.
|
||||||
@@ -70,8 +88,5 @@ ebsnvme_binary_helper_path: '/sbin/go-ebsnvme'
|
|||||||
### nvme to scsi device name map script helper
|
### nvme to scsi device name map script helper
|
||||||
ebsnvme_scrip_helper_path: '/usr/local/bin/ebsnvme-id'
|
ebsnvme_scrip_helper_path: '/usr/local/bin/ebsnvme-id'
|
||||||
|
|
||||||
### auto pvresize (waiting until ansible 2.10 or above as collections have new lvg with integrated pvresize)
|
### resize all pv's to max size
|
||||||
### waiting for new module in collection set to true or run pvresize manually on remote systems
|
|
||||||
### https://docs.ansible.com/ansible/3/collections/community/general/lvg_module.html
|
|
||||||
###
|
|
||||||
pvresize_to_max: false
|
pvresize_to_max: false
|
||||||
|
|||||||
+3
-5
@@ -2,14 +2,12 @@
|
|||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: Larry Smith Jr.
|
author: Larry Smith Jr.
|
||||||
description: Ansible role to manage(create, extend, resize) LVM Groups/Logical Volumes.
|
description: Ansible role to manage(create, extend, resize) LVM Groups/Logical Volumes.
|
||||||
|
namespace: mrlesmithjr
|
||||||
|
role_name: manage-lvm
|
||||||
|
|
||||||
license: MIT
|
license: MIT
|
||||||
min_ansible_version: 1.2
|
min_ansible_version: "1.2"
|
||||||
platforms:
|
platforms:
|
||||||
- name: fedora
|
|
||||||
versions:
|
|
||||||
- 31
|
|
||||||
|
|
||||||
- name: EL
|
- name: EL
|
||||||
versions:
|
versions:
|
||||||
- all
|
- all
|
||||||
|
|||||||
@@ -25,5 +25,5 @@
|
|||||||
manage_lvm: true
|
manage_lvm: true
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Include lvm"
|
- name: "Include lvm"
|
||||||
include_role:
|
ansible.builtin.include_role:
|
||||||
name: "ansible-manage-lvm"
|
name: "ansible-manage-lvm"
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ driver:
|
|||||||
name: vagrant
|
name: vagrant
|
||||||
provider:
|
provider:
|
||||||
name: virtualbox
|
name: virtualbox
|
||||||
lint: yamllint . && flake8 && ansible-lint
|
lint: |
|
||||||
|
yamllint .
|
||||||
|
ansible-lint
|
||||||
|
flake8
|
||||||
platforms:
|
platforms:
|
||||||
- name: CentOS-Molecule-LVM
|
- name: CentOS-Molecule-LVM
|
||||||
box: mrlesmithjr/centos7
|
box: mrlesmithjr/centos7
|
||||||
|
|||||||
@@ -16,6 +16,5 @@ def pytest_runtest_setup(item):
|
|||||||
).get_hosts("all")
|
).get_hosts("all")
|
||||||
else:
|
else:
|
||||||
pytest.skip(
|
pytest.skip(
|
||||||
"Test should run only from inside molecule.",
|
"Test should run only from inside molecule.", allow_module_level=True
|
||||||
allow_module_level=True
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ def test_lvm_package_shall_be_installed(host):
|
|||||||
def test_non_persistent_volume_group_is_created(host):
|
def test_non_persistent_volume_group_is_created(host):
|
||||||
command = """sudo vgdisplay | grep -c 'my_vg'"""
|
command = """sudo vgdisplay | grep -c 'my_vg'"""
|
||||||
cmd = host.run(command)
|
cmd = host.run(command)
|
||||||
assert '1' in cmd.stdout
|
assert "1" in cmd.stdout
|
||||||
|
|
||||||
|
|
||||||
def test_mylv_logical_volume_is_created(host):
|
def test_mylv_logical_volume_is_created(host):
|
||||||
|
|||||||
@@ -25,5 +25,5 @@
|
|||||||
manage_lvm: true
|
manage_lvm: true
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Include lvm"
|
- name: "Include lvm"
|
||||||
include_role:
|
ansible.builtin.include_role:
|
||||||
name: "ansible-manage-lvm"
|
name: "ansible-manage-lvm"
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../default/tests
|
|
||||||
@@ -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,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
|
||||||
@@ -10,5 +10,5 @@
|
|||||||
manage_lvm: true
|
manage_lvm: true
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Include lvm"
|
- name: "Include lvm"
|
||||||
include_role:
|
ansible.builtin.include_role:
|
||||||
name: "ansible-manage-lvm"
|
name: "ansible-manage-lvm"
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../../default/tests/conftest.py
|
|
||||||
@@ -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
|
||||||
|
)
|
||||||
@@ -8,4 +8,4 @@ def test_lvm_package_shall_be_installed(host):
|
|||||||
def test_non_persistent_volume_group_is_created(host):
|
def test_non_persistent_volume_group_is_created(host):
|
||||||
command = """sudo vgdisplay | grep -c 'my_vg'"""
|
command = """sudo vgdisplay | grep -c 'my_vg'"""
|
||||||
cmd = host.run(command)
|
cmd = host.run(command)
|
||||||
assert '1' in cmd.stdout
|
assert "1" in cmd.stdout
|
||||||
|
|||||||
@@ -18,5 +18,5 @@
|
|||||||
manage_lvm: true
|
manage_lvm: true
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Include lvm"
|
- name: "Include lvm"
|
||||||
include_role:
|
ansible.builtin.include_role:
|
||||||
name: "ansible-manage-lvm"
|
name: "ansible-manage-lvm"
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../../default/tests/conftest.py
|
|
||||||
@@ -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
|
||||||
|
)
|
||||||
@@ -8,7 +8,7 @@ def test_lvm_package_shall_be_installed(host):
|
|||||||
def test_non_persistent_volume_group_is_created(host):
|
def test_non_persistent_volume_group_is_created(host):
|
||||||
command = """sudo vgdisplay | grep -c 'my_vg'"""
|
command = """sudo vgdisplay | grep -c 'my_vg'"""
|
||||||
cmd = host.run(command)
|
cmd = host.run(command)
|
||||||
assert '1' in cmd.stdout
|
assert "1" in cmd.stdout
|
||||||
|
|
||||||
|
|
||||||
def test_mylv_logical_volume_is_created(host):
|
def test_mylv_logical_volume_is_created(host):
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
- hosts: test-nodes
|
- name: Example playbook
|
||||||
|
hosts: test-nodes
|
||||||
vars:
|
vars:
|
||||||
lvm_groups:
|
lvm_groups:
|
||||||
- vgname: test-vg
|
- vgname: test-vg
|
||||||
@@ -23,5 +24,5 @@
|
|||||||
manage_lvm: true
|
manage_lvm: true
|
||||||
tasks:
|
tasks:
|
||||||
- name: Include lvm
|
- name: Include lvm
|
||||||
include_role:
|
ansible.builtin.include_role:
|
||||||
name: ansible-manage-lvm
|
name: ansible-manage-lvm
|
||||||
|
|||||||
Generated
+1546
File diff suppressed because it is too large
Load Diff
@@ -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"
|
||||||
+73
-66
@@ -1,66 +1,73 @@
|
|||||||
ansible==2.9.7
|
ansible-compat==3.0.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
ansible-lint==4.2.0
|
ansible-core==2.13.10 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
arrow==0.15.5
|
ansible-lint==6.8.7 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
attrs==19.3.0
|
ansible==6.6.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
bcrypt==3.1.7
|
arrow==1.2.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
binaryornot==0.4.4
|
astroid==2.15.5 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
Cerberus==1.3.2
|
attrs==23.1.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
certifi==2020.4.5.1
|
binaryornot==0.4.4 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
cffi==1.14.0
|
black==22.12.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
chardet==3.0.4
|
bracex==2.3.post1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
click==7.1.1
|
certifi==2023.5.7 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
click-completion==0.5.2
|
cffi==1.15.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
click-help-colors==0.8
|
cfgv==3.3.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
colorama==0.4.3
|
chardet==5.1.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
cookiecutter==1.7.0
|
charset-normalizer==3.1.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
cryptography==2.9
|
click-help-colors==0.9.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
distro==1.5.0
|
click==8.1.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
docker==4.2.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"
|
||||||
entrypoints==0.3
|
cookiecutter==2.1.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
fasteners==0.15
|
cryptography==46.0.6 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
flake8==3.7.9
|
dill==0.3.6 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
future==0.18.2
|
distlib==0.3.6 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
idna==2.9
|
enrich==1.2.7 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
importlib-metadata==1.6.0
|
filelock==3.12.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
Jinja2==2.11.2
|
flake8==6.0.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
jinja2-time==0.2.0
|
identify==2.5.24 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
MarkupSafe==1.1.1
|
idna==3.4 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
mccabe==0.6.1
|
isort==5.12.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
molecule==3.0.3
|
jinja2-time==0.2.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
molecule-vagrant==0.2
|
jinja2==3.1.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
monotonic==1.5
|
jsonschema==4.17.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
more-itertools==8.2.0
|
lazy-object-proxy==1.9.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
packaging==20.3
|
markdown-it-py==3.0.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
paramiko==2.7.1
|
markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pathspec==0.8.0
|
mccabe==0.7.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pexpect==4.8.0
|
mdurl==0.1.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pluggy==0.13.1
|
molecule-plugins[vagrant]==23.4.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
poyo==0.5.0
|
molecule==5.0.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
ptyprocess==0.6.0
|
molecule[docker]==5.0.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
py==1.8.1
|
mypy-extensions==0.4.4 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pycodestyle==2.5.0
|
nodeenv==1.8.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pycparser==2.20
|
packaging==23.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pyflakes==2.1.1
|
pathspec==0.11.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
PyNaCl==1.3.0
|
platformdirs==2.6.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pyparsing==2.4.7
|
pluggy==0.13.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
pytest==5.4.1
|
pre-commit==2.21.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
python-dateutil==2.8.1
|
pycodestyle==2.10.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
python-gilt==1.2.3
|
pycparser==2.21 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
python-vagrant==0.5.15
|
pyflakes==3.0.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
PyYAML==5.3.1
|
pygments==2.20.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
requests==2.23.0
|
pylint==2.17.4 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
ruamel.yaml==0.16.10
|
pyrsistent==0.19.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
ruamel.yaml.clib==0.2.0
|
python-dateutil==2.8.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
selinux==0.2.1
|
python-slugify==8.0.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
sh==1.12.14
|
python-vagrant==1.0.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
shellingham==1.3.2
|
pyyaml==5.4.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
six==1.14.0
|
requests==2.31.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
tabulate==0.8.7
|
resolvelib==0.5.4 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
testinfra==5.0.0
|
rich==13.4.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
tree-format==0.1.2
|
ruamel-yaml-clib==0.2.7 ; platform_python_implementation == "CPython" and python_version < "3.12" and python_version >= "3.9"
|
||||||
urllib3==1.25.9
|
ruamel-yaml==0.17.31 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
wcwidth==0.1.9
|
setuptools==67.8.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
websocket-client==0.57.0
|
six==1.16.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
whichcraft==0.6.1
|
subprocess-tee==0.4.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
yamllint==1.23.0
|
text-unidecode==1.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
zipp==3.1.0
|
tomli==1.2.3 ; python_version >= "3.9" and python_full_version < "3.11.0a7"
|
||||||
|
tomlkit==0.11.8 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
typing-extensions==4.6.3 ; python_version >= "3.9" and python_version < "3.11"
|
||||||
|
urllib3==1.26.16 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
virtualenv==20.21.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
wcmatch==8.4.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
wrapt==1.15.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
yamllint==1.32.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
|||||||
+10
-7
@@ -1,7 +1,10 @@
|
|||||||
ansible-lint==4.2.0
|
ansible-core==2.13.10 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
docker==4.2.0
|
ansible==6.6.0 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
flake8==3.7.9
|
cffi==1.15.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
molecule-vagrant==0.2
|
cryptography==46.0.6 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
molecule==3.0.3
|
jinja2==3.1.2 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
testinfra==5.0.0
|
markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
yamllint==1.23.0
|
packaging==23.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
pycparser==2.21 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
pyyaml==5.4.1 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
resolvelib==0.5.4 ; python_version >= "3.9" and python_version < "4.0"
|
||||||
|
|||||||
+15
-15
@@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: amazon | check for nvme devices
|
- name: amazon | check for nvme devices
|
||||||
shell: |
|
ansible.builtin.shell: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
cat /proc/partitions | awk '{print $4}' | grep -q nvme. ; echo $?
|
cat /proc/partitions | awk '{print $4}' | grep -q nvme. ; echo $?
|
||||||
args:
|
args:
|
||||||
@@ -10,7 +9,7 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: amazon | check for amazon ebs devices
|
- name: amazon | check for amazon ebs devices
|
||||||
shell: |
|
ansible.builtin.shell: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
lsblk -O -J | grep -qi "amazon elastic block store" ; echo $?
|
lsblk -O -J | grep -qi "amazon elastic block store" ; echo $?
|
||||||
register: blkdev_awsebs
|
register: blkdev_awsebs
|
||||||
@@ -19,11 +18,11 @@
|
|||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
||||||
- name: amazon | set flag for nvme subsystem
|
- name: amazon | set flag for nvme subsystem
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
device_is_nvme: "{{ true if (blkdev_nvme.stdout == '0') else false }}"
|
device_is_nvme: "{{ true if (blkdev_nvme.stdout == '0') else false }}"
|
||||||
|
|
||||||
- name: amazon | set flag for aws ebs devices
|
- name: amazon | set flag for aws ebs devices
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
device_is_awsebs: "{{ true if (blkdev_awsebs.stdout == '0') else false }}"
|
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
|
- name: Block to map renamed ec2 ebs nvmeXnY devices to their original sdX/xvdX names
|
||||||
@@ -31,13 +30,14 @@
|
|||||||
become: true
|
become: true
|
||||||
block:
|
block:
|
||||||
- name: amazon | download nvme mapping binary helper
|
- name: amazon | download nvme mapping binary helper
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ ebsnvme_binary_helper_url }}"
|
url: "{{ ebsnvme_binary_helper_url }}"
|
||||||
dest: "{{ ebsnvme_binary_helper_tmp }}/"
|
dest: "{{ ebsnvme_binary_helper_tmp }}/"
|
||||||
|
mode: u=rw,g=r,o=r
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: amazon | extract binary helper
|
- name: amazon | extract binary helper
|
||||||
unarchive:
|
ansible.builtin.unarchive:
|
||||||
src: "{{ ebsnvme_binary_helper_tmp }}/{{ ebsnvme_binary_helper_file }}"
|
src: "{{ ebsnvme_binary_helper_tmp }}/{{ ebsnvme_binary_helper_file }}"
|
||||||
dest: "{{ ebsnvme_binary_helper_tmp }}/"
|
dest: "{{ ebsnvme_binary_helper_tmp }}/"
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
@@ -45,26 +45,26 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: amazon | copy binary helper
|
- name: amazon | copy binary helper
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ ebsnvme_binary_helper_tmp }}/go-ebsnvme"
|
src: "{{ ebsnvme_binary_helper_tmp }}/go-ebsnvme"
|
||||||
dest: "{{ ebsnvme_binary_helper_path }}"
|
dest: "{{ ebsnvme_binary_helper_path }}"
|
||||||
mode: a+x
|
mode: a+x
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
|
|
||||||
- name: amazon | template script helper
|
- name: amazon | template script helper
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: 'ebsnvme-id.j2'
|
src: "ebsnvme-id.j2"
|
||||||
dest: "{{ ebsnvme_scrip_helper_path }}"
|
dest: "{{ ebsnvme_scrip_helper_path }}"
|
||||||
mode: a+x
|
mode: a+x
|
||||||
|
|
||||||
- name: amazon | template udev rule
|
- name: amazon | template udev rule
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: '70-ec2-nvme-devices.rules.j2'
|
src: "70-ec2-nvme-devices.rules.j2"
|
||||||
dest: '/etc/udev/rules.d/70-ec2-nvme-devices.rules'
|
dest: "/etc/udev/rules.d/70-ec2-nvme-devices.rules"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
register: udev_rule
|
register: udev_rule
|
||||||
|
|
||||||
- name: amazon | reload and trigger udev rules
|
- name: amazon | reload and trigger udev rules # noqa no-changed-when no-handler
|
||||||
shell:
|
ansible.builtin.shell:
|
||||||
cmd: udevadm control --reload-rules && udevadm trigger
|
cmd: udevadm control --reload-rules && udevadm trigger
|
||||||
when: udev_rule.changed
|
when: udev_rule.changed
|
||||||
|
|||||||
+39
-26
@@ -1,21 +1,18 @@
|
|||||||
---
|
---
|
||||||
- name: centos | installing lvm2
|
- name: centos | installing lvm2 and sg3_utils
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: lvm2
|
name:
|
||||||
|
- lvm2
|
||||||
|
- sg3_utils
|
||||||
state: present
|
state: present
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- include_tasks: amazon.yml
|
- name: Specific tasks for Amazon EC2
|
||||||
|
ansible.builtin.include_tasks: amazon.yml
|
||||||
when: ansible_facts.system_vendor == 'Amazon EC2'
|
when: ansible_facts.system_vendor == 'Amazon EC2'
|
||||||
|
|
||||||
- name: centos | installing sg3_utils
|
|
||||||
package:
|
|
||||||
name: sg3_utils
|
|
||||||
state: present
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: centos | debug lvg
|
- name: centos | debug lvg
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: lv
|
var: lv
|
||||||
verbosity: 3
|
verbosity: 3
|
||||||
loop: "{{ lookup('subelements', lvm_groups, 'lvnames', {'skip_missing': True}, wantlist=True) }}"
|
loop: "{{ lookup('subelements', lvm_groups, 'lvnames', {'skip_missing': True}, wantlist=True) }}"
|
||||||
@@ -23,7 +20,7 @@
|
|||||||
loop_var: lv
|
loop_var: lv
|
||||||
|
|
||||||
- name: centos | install xfs tools
|
- name: centos | install xfs tools
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "xfsprogs"
|
name: "xfsprogs"
|
||||||
state: "present"
|
state: "present"
|
||||||
become: true
|
become: true
|
||||||
@@ -38,20 +35,36 @@
|
|||||||
- lv.1.create is defined
|
- lv.1.create is defined
|
||||||
- lv.1.create|bool
|
- lv.1.create|bool
|
||||||
|
|
||||||
- name: centos | checking for scsi devices
|
- name: centos | check for scsi adapters
|
||||||
command: sg_scan
|
ansible.builtin.find:
|
||||||
|
paths: "/sys/class/scsi_host"
|
||||||
|
file_type: any
|
||||||
become: true
|
become: true
|
||||||
register: scsi_devices
|
register: scsi_adapters
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: centos | rescanning for new disks
|
- name: centos | Check for new disks
|
||||||
command: /usr/bin/rescan-scsi-bus.sh
|
when: scsi_adapters.matched > 0
|
||||||
become: true
|
block:
|
||||||
changed_when: false
|
- name: centos | installing sg3_utils
|
||||||
when: scsi_devices.stdout|length > 0
|
ansible.builtin.package:
|
||||||
|
name: sg3_utils
|
||||||
|
state: present
|
||||||
|
become: true
|
||||||
|
|
||||||
- name: centos | rescanning for resized disks
|
- name: centos | checking for scsi devices
|
||||||
command: /usr/bin/rescan-scsi-bus.sh -s
|
ansible.builtin.command: sg_scan
|
||||||
become: true
|
become: true
|
||||||
changed_when: false
|
register: scsi_devices
|
||||||
when: scsi_devices.stdout|length > 0
|
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
|
||||||
|
|||||||
+10
-9
@@ -1,11 +1,10 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
# unable to resize xfs: looks like we've to reference the mountpoint instead of the device
|
# unable to resize xfs: looks like we've to reference the mountpoint instead of the device
|
||||||
- name: create_fs | check already converted
|
- name: create_fs | check already converted
|
||||||
# at least xfs is executed twice if the partition has changed in the meantime
|
# 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...
|
# then it tries to recreate the fs on the mounted fs which indeed fails...
|
||||||
shell: "xfs_info {{ lv.mntp }} | grep -c 'ftype=1'"
|
ansible.builtin.shell: "xfs_info {{ lv.mntp }} | grep -c 'ftype=1'"
|
||||||
become: yes
|
become: true
|
||||||
register: mountedxfs
|
register: mountedxfs
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
changed_when: false
|
changed_when: false
|
||||||
@@ -17,7 +16,7 @@
|
|||||||
- lv.create|bool
|
- lv.create|bool
|
||||||
|
|
||||||
- name: create_fs | unmounting filesystem(s)
|
- name: create_fs | unmounting filesystem(s)
|
||||||
mount:
|
ansible.posix.mount:
|
||||||
path: "{{ lv.mntp }}"
|
path: "{{ lv.mntp }}"
|
||||||
src: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
src: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
||||||
fstype: "{{ lv.filesystem | default(omit) }}"
|
fstype: "{{ lv.filesystem | default(omit) }}"
|
||||||
@@ -31,7 +30,7 @@
|
|||||||
- lv.filesystem != "swap"
|
- lv.filesystem != "swap"
|
||||||
|
|
||||||
- name: create_fs | creating new filesystem on new LVM logical volume(s)
|
- name: create_fs | creating new filesystem on new LVM logical volume(s)
|
||||||
filesystem:
|
community.general.filesystem:
|
||||||
fstype: "{{ lv.filesystem }}"
|
fstype: "{{ lv.filesystem }}"
|
||||||
dev: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
dev: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
||||||
resizefs: yes
|
resizefs: yes
|
||||||
@@ -45,12 +44,14 @@
|
|||||||
- lv.create|bool
|
- lv.create|bool
|
||||||
- lv.filesystem is defined
|
- lv.filesystem is defined
|
||||||
- lv.filesystem != 'None'
|
- lv.filesystem != 'None'
|
||||||
|
- lv.filesystem != 'swap'
|
||||||
- lv.filesystem != 'xfs'
|
- lv.filesystem != 'xfs'
|
||||||
|
|
||||||
- name: create_fs | creating new xfs filesystem on new LVM logical volume(s)
|
- name: create_fs | creating new xfs filesystem on new LVM logical volume(s)
|
||||||
filesystem:
|
community.general.filesystem:
|
||||||
fstype: "{{ lv.filesystem }}"
|
fstype: "{{ lv.filesystem }}"
|
||||||
dev: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
dev: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
||||||
|
opts: "{{ lv.fsopts | default(omit) }}"
|
||||||
become: true
|
become: true
|
||||||
when:
|
when:
|
||||||
- mountedxfs is failed
|
- mountedxfs is failed
|
||||||
@@ -64,7 +65,7 @@
|
|||||||
- lv.filesystem == 'xfs'
|
- lv.filesystem == 'xfs'
|
||||||
|
|
||||||
- name: create_fs | mounting new filesystem(s)
|
- name: create_fs | mounting new filesystem(s)
|
||||||
mount:
|
ansible.posix.mount:
|
||||||
path: "{{ lv.mntp }}"
|
path: "{{ lv.mntp }}"
|
||||||
src: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
src: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
||||||
fstype: "{{ lv.filesystem }}"
|
fstype: "{{ lv.filesystem }}"
|
||||||
@@ -81,8 +82,8 @@
|
|||||||
- lv.mount is defined
|
- lv.mount is defined
|
||||||
- lv.mount|bool
|
- lv.mount|bool
|
||||||
|
|
||||||
- name: create_fs | resizing xfs filesystem on new LVM logical volume(s)
|
- name: create_fs | resizing xfs filesystem on new LVM logical volume(s) # noqa no-changed-when
|
||||||
command: "xfs_growfs {{ lv.mntp }}"
|
ansible.builtin.command: "xfs_growfs {{ lv.mntp }}"
|
||||||
become: true
|
become: true
|
||||||
when:
|
when:
|
||||||
- vg.create is defined
|
- vg.create is defined
|
||||||
|
|||||||
+4
-5
@@ -1,12 +1,11 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: create_lv | Display Volume Group
|
- name: create_lv | Display Volume Group
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: vg
|
var: vg
|
||||||
verbosity: 2
|
verbosity: 2
|
||||||
|
|
||||||
- name: create_lv | creating new LVM logical volume(s)
|
- name: create_lv | creating new LVM logical volume(s)
|
||||||
lvol:
|
community.general.lvol:
|
||||||
vg: "{{ vg.vgname }}"
|
vg: "{{ vg.vgname }}"
|
||||||
lv: "{{ lv.lvname }}"
|
lv: "{{ lv.lvname }}"
|
||||||
size: "{{ lv.size }}"
|
size: "{{ lv.size }}"
|
||||||
@@ -24,8 +23,8 @@
|
|||||||
- lv.create|bool
|
- lv.create|bool
|
||||||
|
|
||||||
- name: create_lv | debug changed attribute
|
- name: create_lv | debug changed attribute
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: lvchanged
|
var: lvchanged
|
||||||
|
|
||||||
- name: create_lv | configuring FS
|
- name: create_lv | configuring FS
|
||||||
include_tasks: create_fs.yml
|
ansible.builtin.include_tasks: create_fs.yml
|
||||||
|
|||||||
+3
-15
@@ -1,29 +1,17 @@
|
|||||||
---
|
---
|
||||||
- name: create_vg | creating new LVM volume group(s)
|
- name: create_vg | creating new LVM volume group(s)
|
||||||
lvg:
|
community.general.lvg:
|
||||||
vg: "{{ vg.vgname }}"
|
vg: "{{ vg.vgname }}"
|
||||||
pvs: "{{ vg.disks | join(',') }}"
|
pvs: "{{ vg.disks | join(',') }}"
|
||||||
state: present
|
state: present
|
||||||
|
pvresize: "{{ vg.pvresize | default(pvresize_to_max) }}"
|
||||||
become: true
|
become: true
|
||||||
when:
|
when:
|
||||||
- vg.create is defined
|
- vg.create is defined
|
||||||
- vg.create|bool
|
- vg.create|bool
|
||||||
|
|
||||||
### workaround: auto pvresize waiting for upgrade to new module supporting integrated pvresize
|
|
||||||
### ref: https://docs.ansible.com/ansible/3/collections/community/general/lvg_module.html
|
|
||||||
- name: create_vg | pvresize to max available free space
|
|
||||||
command: "pvresize {{ pv }}"
|
|
||||||
loop: "{{ vg.disks | default([]) }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: pv
|
|
||||||
changed_when: false
|
|
||||||
when:
|
|
||||||
- vg.create is defined
|
|
||||||
- vg.create|bool
|
|
||||||
- pvresize_to_max|bool
|
|
||||||
|
|
||||||
- name: manage_lvm | loop over logical volume group(s) to create logical volumes
|
- name: manage_lvm | loop over logical volume group(s) to create logical volumes
|
||||||
include_tasks: create_lv.yml
|
ansible.builtin.include_tasks: create_lv.yml
|
||||||
loop: "{{ vg.lvnames | default([]) }}"
|
loop: "{{ vg.lvnames | default([]) }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: lv
|
loop_var: lv
|
||||||
|
|||||||
+7
-7
@@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
- name: debian | Updating Apt Cache
|
- name: debian | Updating Apt Cache
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
cache_valid_time: 3600
|
cache_valid_time: 3600
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: debian | installing pre-reqs
|
- name: debian | installing pre-reqs
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name:
|
name:
|
||||||
- lvm2
|
- lvm2
|
||||||
- scsitools
|
- scsitools
|
||||||
@@ -14,11 +14,11 @@
|
|||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: debian | install xfs tools
|
- name: debian | install xfs tools
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: xfsprogs
|
name: xfsprogs
|
||||||
state: present
|
state: present
|
||||||
become: true
|
become: true
|
||||||
loop: "{{ lvm_groups|subelements('lvnames') }}"
|
loop: "{{ lvm_groups | subelements('lvnames') }}"
|
||||||
when:
|
when:
|
||||||
- item.1 is defined
|
- item.1 is defined
|
||||||
- item.1 != 'None'
|
- item.1 != 'None'
|
||||||
@@ -28,13 +28,13 @@
|
|||||||
- item.1.create|bool
|
- item.1.create|bool
|
||||||
|
|
||||||
- name: debian | checking for scsi devices
|
- name: debian | checking for scsi devices
|
||||||
command: sg_scan
|
ansible.builtin.command: sg_scan
|
||||||
become: true
|
become: true
|
||||||
register: scsi_devices
|
register: scsi_devices
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: debian | rescanning for new disks added
|
- name: debian | rescanning for new disks added
|
||||||
command: /sbin/rescan-scsi-bus
|
ansible.builtin.command: "{{ rescan_scsi_command }}"
|
||||||
become: true
|
become: true
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when: scsi_devices['stdout'] | length
|
when: scsi_devices['stdout'] | length > 0
|
||||||
|
|||||||
+14
-3
@@ -1,12 +1,23 @@
|
|||||||
---
|
---
|
||||||
# tasks file for ansible-manage-lvm
|
# tasks file for ansible-manage-lvm
|
||||||
- include_tasks: debian.yml
|
- 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, '<=')
|
||||||
|
|
||||||
|
- name: Debian specific tasks
|
||||||
|
ansible.builtin.include_tasks: debian.yml
|
||||||
when: ansible_facts.os_family == "Debian"
|
when: ansible_facts.os_family == "Debian"
|
||||||
|
|
||||||
- include_tasks: centos.yml
|
- name: RHEL specific tasks
|
||||||
|
ansible.builtin.include_tasks: centos.yml
|
||||||
when: ansible_facts.os_family == "RedHat"
|
when: ansible_facts.os_family == "RedHat"
|
||||||
|
|
||||||
- include_tasks: manage_lvm.yml
|
- name: Manage LVM
|
||||||
|
ansible.builtin.include_tasks: manage_lvm.yml
|
||||||
when:
|
when:
|
||||||
- lvm_groups is defined
|
- lvm_groups is defined
|
||||||
- manage_lvm|bool
|
- manage_lvm|bool
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
---
|
---
|
||||||
- name: manage_lvm | manage physical volume group creation
|
- name: manage_lvm | manage physical volume group creation
|
||||||
include_tasks: create_vg.yml
|
ansible.builtin.include_tasks: create_vg.yml
|
||||||
loop: "{{ lvm_groups }}"
|
loop: "{{ lvm_groups }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: vg
|
loop_var: vg
|
||||||
|
|
||||||
- name: manage_lvm | Removing LVM logical volume(s)
|
- name: manage_lvm | Removing LVM logical volume(s)
|
||||||
lvol:
|
community.general.lvol:
|
||||||
vg: "{{ item.0.vgname }}"
|
vg: "{{ item.0.vgname }}"
|
||||||
lv: "{{ item.1.lvname }}"
|
lv: "{{ item.1.lvname }}"
|
||||||
state: absent
|
state: absent
|
||||||
force: true
|
force: true
|
||||||
become: true
|
become: true
|
||||||
loop: "{{ lvm_groups|subelements('lvnames', {'skip_missing': true}) }}"
|
loop: "{{ lvm_groups | subelements('lvnames', {'skip_missing': true}) }}"
|
||||||
when:
|
when:
|
||||||
- item.1 is defined
|
- item.1 is defined
|
||||||
- item.1 != 'None'
|
- item.1 != 'None'
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
- not item.1.create|bool
|
- not item.1.create|bool
|
||||||
|
|
||||||
- name: manage_lvm | Removing LVM volume group(s)
|
- name: manage_lvm | Removing LVM volume group(s)
|
||||||
lvg:
|
community.general.lvg:
|
||||||
vg: "{{ item.vgname }}"
|
vg: "{{ item.vgname }}"
|
||||||
pvs: "{{ item.disks | join(',') }}"
|
pvs: "{{ item.disks | join(',') }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
# ebs nvme to scsi device naming mapping
|
# 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"
|
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"
|
||||||
|
|
||||||
|
|||||||
@@ -12,4 +12,3 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
{{ ebsnvme_binary_helper_path }} -n $1 | awk -F '/' '{print $3}'
|
{{ ebsnvme_binary_helper_path }} -n $1 | awk -F '/' '{print $3}'
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
skip_list: ['305','503','602']
|
skip_list: ['305', '503', '602']
|
||||||
|
|||||||
+5
-4
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
- hosts: localhost
|
# - name: Test role
|
||||||
connection: local
|
# hosts: localhost
|
||||||
roles:
|
# connection: local
|
||||||
- ansible-manage-lvm
|
# roles:
|
||||||
|
# - role: ansible-manage-lvm
|
||||||
|
|||||||
@@ -3,3 +3,5 @@
|
|||||||
|
|
||||||
ebsnvme_binary_helper_file: go-ebsnvme_{{ ebsnvme_binary_helper_ver }}_linux_amd64.tar.gz
|
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 }}
|
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"
|
||||||
|
|||||||
Reference in New Issue
Block a user