lvmconf
Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x
- Puppet > 6.0.0 < 9.0.0
- , ,
Start using this module
Add this module to your Puppetfile:
mod 'arden-lvmconf', '0.1.1'
Learn more about managing modules with a PuppetfileDocumentation
lvmconf
Table of Contents
- Description
- Setup - The basics of getting started with lvmconf
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Description
The lvmconf module delivers two main sets of functionality:
- A resource type for directly managing entries in
lvm.conf
calledlvm_config
. - Pre-built logic to emulate the behavior of the
lvmconf
used to configure a system for HA LVM.
Setup
What lvmconf affects
1 - Packages
When enabled lvmconf will attempt to install the lvm2 package. Note that hiera defaults exist for RedHat 7 family operating systems, however, other operating systems will need to have the package_name
parameter specified.
2 - lvm config
This class includes a provider for manipulating entries in /etc/lvm/lvm.conf
using the lvmconfig
command. Depending on the mode selected in the main class several configuration directives will be updated automatically. Currently this is limited to the following:
global/use_lvmetad
- Controls the use of the LVM metadata daemon. When HA LVM is configured this must be disabledglobal/locking_type
- Controls the locking method used by LVM. This is needs to be set to standard locking for both halvm and standard modes of operation.
When halvm
is enabled it is also important to configure the activation/volume_list
parameter. This provides a white-list of volume groups which are safe for LVM to automatically import. Obviously any volumes which are part of an HA LVM scenario should be excluded from this list.
2 - Services
The state of the following services is managed automatically when mode
is changed:
metad
- the lvm metadata daemon (lvmetad). In a standard system without HA LVM this daemon is used to accelerate lvm query commands by caching states in memory. This must be disabled when used with HA LVM
Additionally, if enabled, this class can automatically regenerate the initramfs to incorporate the changes to lvm.conf
.
Beginning with lvmconf
On a RedHat 7 based operating system enabling standard configuration can be performed via the following simple call:
class { 'lvmconf':
manage_package => true,
mode => 'standard',
}
Usage
The following examples assume a RedHat 7 based operating system. If a different operating system is used which does not have module hiera data additional parameters will need to be specified.
Enabling HA LVM
class { 'lvmconf':
mode => 'halvm'
manage_initramfs => true,
local_vgs => [ 'rootvg' ],
}
Alternatively the same configuration can be performed via hiera.
lvmconf::mode: 'halvm'
lvmconf::manage_initramfs: true
lvmconf::local_vgs:
- 'rootvg'
include lvmconf
Enabling Standard LVM
class { 'lvmconf':
mode => 'standard'
manage_initramfs => true,
}
Alternatively the same configuration can be performed via hiera.
lvmconf::mode: 'standard'
lvmconf::manage_initramfs: true
include lvmconf
Limitations
- Enabling / disabling
clvmd
orcmirrord
is currently not supported by this module. - Initramfs updates are limited to dracut, however, other generators such as genkernel likely could be added.
- When
lvm.conf
parameters are modified there is no way to automatically reset them to default values. Such changes must be carried out directly on the target nodes.
Development
See the contributing guide.
Contributors
Check out the contributor list.
Reference
Table of Contents
Classes
lvmconf
: Performs basic management of LVM in a RedHat environment.lvmconf::config
: Enforces lvm.conf based on lvmconf mode flagslvmconf::install
: Install the lvm package if specifiedlvmconf::service
: Manage the state of each LVM related service based on lvmconf mode
Resource types
lvm_config
: Type to manage entries in the/etc/lvm/lvm.conf
config file via the lvmconfig (aka lvm config) command. Example: ```puppet lvm_config { '
Data types
Lvmconf::InitramfsType
: List of valid initramfs provider typesLvmconf::Mode
: List of valid modes for LVM executionLvmconf::Service
: List of valid lvm related service names
Classes
lvmconf
Ensures that LVM is configured correctly on each
Examples
Trivial configuration of 'standard' mode
include lvmconf
Install package and enable HA LVM
class { 'lvmconf':
systemd => true,
service_map => {'metad' => 'lvm2-lvmetad'},
manage_package => true,
mode => 'halvm',
package_name => 'lvm',
local_vgs => [ 'rootvg', 'nonclustervg' ],
}
Parameters
The following parameters are available in the lvmconf
class:
systemd
Data type: Boolean
Indicates whether this system uses systemd or sysv as it's init system. Different services will be manipulated depending on the value of this parameter.
service_map
Data type: Hash[Lvmconf::Service, String]
A hash mapping general names of LVM services to their OS/init system specific variants. Currently only the 'metad' entry is used directly.
Default value: {}
mode
Data type: Lvmconf::Mode
Configures the local LVM instance operation mode. See man lvmconf
for more
detail.
Default value: 'standard'
manage_package
Data type: Boolean
When true puppet will attempt to install the lvm2 package on this host.
Default value: false
package_name
Data type: Optional[String[1]]
Name of the LVM2 package for retrieval by the local package manager on the
target system. Operating systems which are explicitly supported
have hiera configured defaults for this parameter. It is mandatory when
manage_package
is true.
Default value: undef
manage_initramfs
Data type: Boolean
When true the local initramfs will be regenerated to take the changes to lvm.conf into account.
Default value: false
initramfs_type
Data type: Lvmconf::InitramfsType
Indicates the type of initramfs to be modified. Currently, only dracut is supported by this module.
Default value: 'dracut'
local_vgs
Data type: Array[String]
Whitelist of local-only volume groups which will be automatically imported by LVM. Each entry in this array will be added to the 'activation/volume_list' array in lvm.conf. This is critical when halvm or clustered LVM are enabled.
Default value: []
lvmconf::config
Enforces lvm.conf based on lvmconf mode flags
lvmconf::install
Install the lvm package if specified
lvmconf::service
Manage the state of each LVM related service based on lvmconf mode
Resource types
lvm_config
Type to manage entries in the /etc/lvm/lvm.conf
config file via
the lvmconfig (aka lvm config) command.
Example:
lvm_config { 'activation/volume_list':
value => [\"vg1\",\"vg2\"],
}
Properties
The following properties are available in the lvm_config
type.
value
Data to be stored as the value for the specified Section/Setting key. Some validation is performed by lvmconfig during the apply process. If an error can be detected the provider will also generate a failure during the apply.
Parameters
The following parameters are available in the lvm_config
type.
include_comments
Valid values: true
, false
, yes
, no
When true full descriptive comments will be included in the resulting lvm config file. Note that currently this is all or nothing. If you want to ensure comments are not included make sure you disable this for every instance of lvm_config!
Default value: true
name
namevar
The Section/Setting key string which corresponds to the desired
variable. See the output of lvmconfig -l
for reference. Values are
not validated, however, the keys themselves are tested prior to creating
the entry.
provider
The specific backend to use for this lvm_config
resource. You will seldom need to specify this --- Puppet will usually
discover the appropriate provider for your platform.
Data types
Lvmconf::InitramfsType
List of valid initramfs provider types
Alias of Enum['dracut']
Lvmconf::Mode
List of valid modes for LVM execution
Alias of Enum['halvm', 'cluster', 'standard']
Lvmconf::Service
List of valid lvm related service names
Alias of Enum['metad', 'lvm', 'monitor']
MIT License Copyright (c) 2019 arden-puppet Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.