mirror of
https://github.com/mrlesmithjr/ansible-manage-lvm.git
synced 2026-09-05 15:08:12 +03:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 098bd79154 | |||
| fddf9804dd | |||
| 506da4707e | |||
| 773ce28061 | |||
| 1bb56066fe | |||
| cb792e59a6 | |||
| 48e3be3c5c | |||
| 2492c96566 | |||
| e4bc8a9e9b | |||
| 1d57a469b0 | |||
| 19e56ac7d8 | |||
| 5c3e601078 | |||
| 535b410363 | |||
| f87c42a8c5 | |||
| 34e4f08c31 |
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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 }}
|
||||||
@@ -61,3 +61,17 @@ lvm_groups: []
|
|||||||
# 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.
|
||||||
manage_lvm: false
|
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'
|
||||||
|
|
||||||
|
### auto pvresize (waiting until ansible 2.10 or above as collections have new lvg with integrated pvresize)
|
||||||
|
### 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
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: amazon | check for nvme devices
|
||||||
|
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
|
||||||
|
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
|
||||||
|
set_fact:
|
||||||
|
device_is_nvme: "{{ true if (blkdev_nvme.stdout == '0') else false }}"
|
||||||
|
|
||||||
|
- name: amazon | set flag for aws ebs devices
|
||||||
|
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
|
||||||
|
get_url:
|
||||||
|
url: "{{ ebsnvme_binary_helper_url }}"
|
||||||
|
dest: "{{ ebsnvme_binary_helper_tmp }}/"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: amazon | extract binary helper
|
||||||
|
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
|
||||||
|
copy:
|
||||||
|
src: "{{ ebsnvme_binary_helper_tmp }}/go-ebsnvme"
|
||||||
|
dest: "{{ ebsnvme_binary_helper_path }}"
|
||||||
|
mode: a+x
|
||||||
|
remote_src: yes
|
||||||
|
|
||||||
|
- name: amazon | template script helper
|
||||||
|
template:
|
||||||
|
src: 'ebsnvme-id.j2'
|
||||||
|
dest: "{{ ebsnvme_scrip_helper_path }}"
|
||||||
|
mode: a+x
|
||||||
|
|
||||||
|
- name: amazon | template udev rule
|
||||||
|
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
|
||||||
|
shell:
|
||||||
|
cmd: udevadm control --reload-rules && udevadm trigger
|
||||||
|
when: udev_rule.changed
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
state: present
|
state: present
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
|
- include_tasks: amazon.yml
|
||||||
|
when: ansible_system_vendor == 'Amazon EC2'
|
||||||
|
|
||||||
- name: centos | installing sg3_utils
|
- name: centos | installing sg3_utils
|
||||||
package:
|
package:
|
||||||
name: sg3_utils
|
name: sg3_utils
|
||||||
@@ -45,3 +48,10 @@
|
|||||||
command: /usr/bin/rescan-scsi-bus.sh
|
command: /usr/bin/rescan-scsi-bus.sh
|
||||||
become: true
|
become: true
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
when: scsi_devices.stdout|length > 0
|
||||||
|
|
||||||
|
- name: centos | rescanning for resized disks
|
||||||
|
command: /usr/bin/rescan-scsi-bus.sh -s
|
||||||
|
become: true
|
||||||
|
changed_when: false
|
||||||
|
when: scsi_devices.stdout|length > 0
|
||||||
|
|||||||
@@ -9,6 +9,19 @@
|
|||||||
- 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
|
include_tasks: create_lv.yml
|
||||||
loop: "{{ vg.lvnames | default([]) }}"
|
loop: "{{ vg.lvnames | default([]) }}"
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# 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"
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#!/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,2 +1,5 @@
|
|||||||
---
|
---
|
||||||
# vars file for ansible-manage-lvm
|
# 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 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user