• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    Ruby
  • License
    GNU General Publi...
  • Created about 14 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Puppet Module to manage LVM

Puppet LVM Module

Provides Logical Resource Management (LVM) features for Puppet.

Usage Examples

This module provides four resource types (and associated providers): volume_group, logical_volume, physical_volume, and filesystem.

The basic dependency graph needed to define a working logical volume looks something like:

filesystem -> logical_volume -> volume_group -> physical_volume(s)

Here's a simple working example:

physical_volume { '/dev/hdc':
  ensure => present,
}

volume_group { 'myvg':
  ensure           => present,
  physical_volumes => '/dev/hdc',
}

logical_volume { 'mylv':
  ensure       => present,
  volume_group => 'myvg',
  size         => '20G',
}

filesystem { '/dev/myvg/mylv':
  ensure  => present,
  fs_type => 'ext3',
  options => '-b 4096 -E stride=32,stripe-width=64',
}

This simple 1 physical volume, 1 volume group, 1 logical volume case is provided as a simple volume definition, as well. The above could be shortened to be:

lvm::volume { 'mylv':
  ensure => present,
  vg     => 'myvg',
  pv     => '/dev/hdc',
  fstype => 'ext3',
  size   => '20G',
}

You can also describe your Volume Group like this:

class { 'lvm':
  volume_groups    => {
    'myvg' => {
      physical_volumes => [ '/dev/sda2', '/dev/sda3', ],
      logical_volumes  => {
        'opt'    => {'size' => '20G'},
        'tmp'    => {'size' => '1G' },
        'usr'    => {'size' => '3G' },
        'var'    => {'size' => '15G'},
        'home'   => {'size' => '5G' },
        'backup' => {
          'size'              => '5G',
          'mountpath'         => '/var/backups',
          'mountpath_require' => true,
        },
      },
    },
  },
}

This could be really convenient when used with hiera:

include ::lvm

and

---
lvm::volume_groups:
  myvg:
    physical_volumes:
      - /dev/sda2
      - /dev/sda3
    logical_volumes:
      opt:
        size: 20G
      tmp:
        size: 1G
      usr:
        size: 3G
      var:
        size: 15G
      home:
        size: 5G
      backup:
        size: 5G
        mountpath: /var/backups
        mountpath_require: true

or to just build the VG if it does not exist

---
lvm::volume_groups:
  myvg:
    createonly: true
    physical_volumes:
      /dev/sda2:
        unless_vg: 'myvg'
      /dev/sda3:
        unless_vg: 'myvg'
    logical_volumes:
      opt:
        size: 20G
      tmp:
        size: 1G
      usr:
        size: 3G
      var:
        size: 15G
      home:
        size: 5G
      backup:
        size: 5G
        mountpath: /var/backups
        mountpath_require: true

Except that in the latter case you cannot specify create options. If you want to omit the file system type, but still specify the size of the logical volume, i.e. in the case if you are planning on using this logical volume as a swap partition or a block device for a virtual machine image, you need to use a hash to pass the parameters to the definition.

If you need a more complex configuration, you'll need to build the resources out yourself.

Optional Values

The unless_vg (physical_volume) and createonly (volume_group) will check to see if "myvg" exists. If "myvg" does exist then they will not modify the physical volume or volume_group. This is useful if your environment is built with certain disks but they change while the server grows, shrinks or moves.

Example:

    physical_volume { "/dev/hdc":
        ensure => present,
        unless_vg => "myvg"
    }
    volume_group { "myvg":
        ensure => present,
        physical_volumes => "/dev/hdc",
        createonly => true
    }

Type Documentation

filesystem

  • name (Parameter) (Namevar)
  • ensure (Property)
  • fs_type (Parameter) - The file system type. eg. ext3.
  • mkfs_cmd (Parameter) - Command to use to create the file system. Defaults to mkswap for fs_type=swap, otherwise mkfs.{fs_type}
  • options (Parameter) - Params for the mkfs command. eg. -l internal,agcount=x

logical_volume

  • name (Parameter) (Namevar) - The name of the logical volume. This is the unqualified name and will be automatically added to the volume group’s device path (e.g., ‘/dev/$vg/$lv’).
  • ensure (Property)
  • alloc (Parameter) - Selects the allocation policy when a command needs to allocate Physical Extents from the Volume Group. Allowed Values:
    • :anywhere
    • :contiguous
    • :cling
    • :inherit
    • :normal
  • extents (Parameter) - The number of logical extents to allocate for the new logical volume. Set to undef to use all available space
  • initial_size (Parameter) - The initial size of the logical volume. This will only apply to newly-created volumes
  • minor (Parameter) - Set the minor number
  • mirror (Property) - The number of mirrors of the volume.
  • mirrorlog (Property) - How to store the mirror log (core, disk, mirrored). Allowed Values:
    • :core
    • :disk
    • :mirrored
  • mounted - If puppet should mount the volume. This only affects what puppet will do, and not what will be mounted at boot-time.
  • no_sync (Parameter) - An optimization in lvcreate, at least on Linux.
  • persistent (Parameter) - Set to true to make the block device persistent
  • poolmetadatasize (Parameter) - Set the initial size of the logical volume pool metadata on creation
  • readahead (Parameter) - The readahead count to use for the new logical volume.
  • region_size (Parameter) - A mirror is divided into regions of this size (in MB), the mirror log uses this granularity to track which regions are in sync. CAN NOT BE CHANGED on already mirrored volume. Take your mirror size in terabytes and round up that number to the next power of 2, using that number as the -R argument.
  • size (Property) - The size of the logical volume. Set to undef to use all available space
  • size_is_minsize (Parameter) Default value: false - Set to true if the ‘size’ parameter specified, is just the minimum size you need (if the LV found is larger then the size requests this is just logged not causing a FAIL)
  • stripes (Parameter) - The number of stripes to allocate for the new logical volume.
  • stripesize (Parameter) - The stripesize to use for the new logical volume.
  • thinpool (Parameter) - Default value: false - Set to true to create a thin pool or to pool name to create thin volume
  • volume_group (Parameter) - The volume group name associated with this logical volume. This will automatically set this volume group as a dependency, but it must be defined elsewhere using the volume_group resource type.

physical_volume

  • name (Parameter) (Namevar)
  • ensure (Property) -
  • force (Parameter) Default value: false - Force the creation without any confirmation. Allowed Values:
    • true
    • false
  • unless_vg (Parameter) - Do not do anything if the VG already exists. The value should be the name of the volume group to check for.

volume_group

  • name (Parameter) (Namevar) - The name of the volume group.
  • ensure (Property)
  • createonly (Parameter) Default value: false - If set to true the volume group will be created if it does not exist. If the volume group does exist no action will be taken. Defaults to false. Allowed Values:
    • true
    • false
  • followsymlinks (Parameter) - If set to true all current and wanted values of the physical_volumes property will be followed to their real files on disk if they are in fact symlinks. This is useful to have Puppet determine what the actual PV device is if the property value is a symlink, like '/dev/disk/by-path/xxxx -> ../../sda'. Defaults to false.
  • physical_volumes (Property) - The list of physical volumes to be included in the volume group; this will automatically set these as dependencies, but they must be defined elsewhere using the physical_volume resource type.

AIX Specific Type Documentation

There are a number of AIX specific parameters and properties. The regular parameters documented above also apply to AIX systems.

filesystem

  • accounting (Parameter) - Specify accounting subsystem support, Allowed Values:
    • true
    • false
  • ag_size (Parameter) - Specify the allocation group size in megabytes, Allowed Values:
    • /\d+/
  • agblksize (Parameter) - JFS2 block size in bytes, Allowed Values:
    • /\d+/
  • atboot (Parameter) - Specify whether the file system is mounted at boot time, Allowed Values:
    • true
    • false
  • compress (Parameter) - Data compression, LZ or no. Allowed Values:
    • :LG
    • :no
  • device (Parameter) - Device to create the filesystem on, this can be a device or a logical volume.
  • encrypted (Parameter) - Specify and encrypted filesystem. Allowed Values:
    • true
    • false
  • extended_attributes (Parameter) - Format to be used to store extended attributes. Allowed Values:
    • :v1
    • :v2
  • frag (Parameter) - JFS fragment size in bytes. Allowed Values:
    • /\d+/
  • initial_size (Parameter) - Initial size of the filesystem, Used only for resource creation, when using this option Puppet will not manage or maintain the size. To resize filesystems see the size property.
  • isnapshot (Parameter) - Specify whether the filesystem supports internal snapshots, Allowed Values:
    • true
    • false
  • large_files (Parameter) - Large file enabled file system. Allowed Values:
    • true
    • false
  • log_partitions (Parameter) - Specify the size of the log logical volume as number of logical partitions,
  • logname (Parameter) - Configure the log logical volume.
  • logsize (Parameter) - Size for an inline log in MB, Allowed Values:
    • /\d+/
  • maxext (Parameter) - Size of a file extent in file system blocks, Allowed Values:
    • /\d+/
  • mount_options (Parameter) - Specify the options to be passed to the mount command.
  • mountgroup (Parameter) - Mount group for the filesystem,
  • mountguard (Parameter) - Enable the mountguard. Allowed Values:
    • true
    • false
  • nbpi (Parameter) - Bytes per inode. Allowed Values:
    • /\d+/
  • nodename (Parameter) - Specify the remote host where the filesystem resides.
  • perms (Parameter) - Permissions for the filesystem, Allowed Values:
    • :ro
    • :rw
  • size (Property) - Configures the size of the filesystem. Supports filesystem resizing. The size will be rounded up to the nearest multiple of the partition size.
  • vix (Parameter) - Specify that the file system can allocate inode extents smaller than the default, Allowed Values:
    • true
    • false
  • volume_group (Parameter) - Volume group that the file system should be greated on.

logical_volume

  • range (Parameter) - Sets the inter-physical volume allocation policy. AIX only
  • type (Parameter) - Configures the logical volume type. AIX only

Functions

lvm::bytes_to_size: Converts a number of bytes to a size format that LVM can understand e.g. lvm::bytes_to_size(214748364800) would return 200g

lvm::size_to_bytes: Converts an LVM size to bytes, the opposite of lvm::bytes_to_size.

Tasks

Documented in the "Tasks" tab on the forge

Plans

lvm::expand

Executes common tasks for expanding mounts, this can include:

  • Creating PVs
  • Adding PVs to VG
  • Extending LV
  • Extending filesystem

Parameters:

server: String The target for the plan

volume_group: String The volume group to which the logical volume belongs

logical_volume: String The logical volume which is to be expanded

additional_size: String How much size to add to the LV. This should be specified in LVM format i.e. "200m" or "2.5g"

disks: Array[String] Any physical disks that should be added to the volume group as part of the expand process

resize_fs: Boolean Whether or not to resize the filesystem

Limitations

Namespacing

Due to puppet's lack of composite keys for resources, you currently cannot define two logical_volume resources with the same name but a different volume_group.

Removing Physical Volumes

You should not remove a physical_volume from a volume_group without ensuring the physical volume is no longer in use by a logical volume (and possibly doing a data migration with the pvmove executable).

Removing a physical_volume from a volume_group resource will cause the pvreduce to be executed -- no attempt is made to ensure pvreduce does not attempt to remove a physical volume in-use.

Resizing Logical Volumes

Logical volume size can be extended, but not reduced -- this is for safety, as manual intervention is probably required for data migration, etc.

Contributors

Bruce Williams [email protected]

Daniel Kerwin [email protected]

Luke Kanies [email protected]

Matthaus Litteken [email protected]

Michael Stahnke [email protected]

Mikael Fridh [email protected]

Tim Hawes [email protected]

Yury V. Zaytsev [email protected]

csschwe [email protected]

windowsrefund [email protected]

Adam Gibbins [email protected]

Steffen Zieger [email protected]

Jason A. Smith [email protected]

Mathieu Bornoz [email protected]

Cédric Jeanneret [email protected]

Raphaël Pinson [email protected]

Garrett Honeycutt [email protected]

More Contributers

More Repositories

1

puppet

Server automation framework and application
Ruby
7,082
star
2

showoff

Don't just present; interact with your audience!
JavaScript
932
star
3

r10k

Smarter Puppet deployment
Ruby
800
star
4

facter

Collect and display system facts
Ruby
603
star
5

trapperkeeper

A services framework for Clojure / JVM applications.
Clojure
586
star
6

bolt

Bolt is an open source orchestration tool that automates the manual work it takes to maintain your infrastructure on an as-needed basis or as part of a greater orchestration workflow. It can be installed on your local workstation and connects directly to remote nodes with SSH or WinRM, so you are not required to install any agent software.
Ruby
459
star
7

puppetlabs-mysql

MySQL Puppet Module / Manifests + Types & Providers
Ruby
385
star
8

puppetlabs-apache

Puppet module for the Apache httpd server, maintained by Puppet, Inc.
Ruby
365
star
9

puppetlabs-stdlib

Puppet Labs Standard Library module
Ruby
350
star
10

hiera

Lightweight Pluggable Hierarchical Database
Ruby
295
star
11

puppetdb

Centralized Puppet Storage
Clojure
290
star
12

puppetserver

Server automation framework and application
Clojure
280
star
13

puppetlabs-firewall

Puppet Firewall Module
Ruby
269
star
14

puppetlabs-postgresql

Puppet module for managing PostgreSQL
Ruby
228
star
15

puppet-docs

Curated Puppet Documentation
HTML
223
star
16

pdk

The shortest path to better modules: Puppet Development Kit; Download:
Ruby
217
star
17

control-repo

A control repository template
Ruby
197
star
18

pupperware

Container fun time lives here.
Ruby
183
star
19

puppetlabs-concat

File concatenation system for Puppet
Ruby
171
star
20

puppet-vagrant-boxes

Veewee definitions for a set of generic vagrant boxes
Shell
153
star
21

puppetlabs-ntp

Puppet module to manage the NTP service
Ruby
145
star
22

puppetlabs_spec_helper

A set of shared spec helpers specific to Puppetlabs projects
Ruby
121
star
23

best-practices

Best practice docs created by the Puppet Customer Success team
CSS
120
star
24

puppetlabs-packer

Packer templates to build images for vSphere
PowerShell
119
star
25

puppetlabs-java

Puppet Module to manage Java
Ruby
103
star
26

puppet-syntax-vim

Puppet language syntax highlighting for Vim
Vim Script
102
star
27

puppet-specifications

Specification of the Puppet Language, Catalog, Extension points
Ruby
97
star
28

vault-plugin-secrets-oauthapp

OAuth 2.0 secrets plugin for HashiCorp Vault supporting a variety of grant types
Go
94
star
29

puppetlabs-kubernetes

This module install and configures a Kubernetes cluster
Ruby
92
star
30

puppet-strings

The next generation Puppet documentation extraction and presentation tool.
Ruby
89
star
31

puppet_litmus

Providing a simple command line tool for puppet content creators, to enable simple and complex test deployments.
Ruby
88
star
32

puppetlabs-docker

The Puppet Docker repository
Ruby
87
star
33

cpp-hocon

A C++ port of the Typesafe Config library.
C++
83
star
34

education-builds

Bootstrap CentOS training VMs from scratch. Now with true versioning!
Ruby
82
star
35

puppet-vscode

Puppet Editing. Redefined.
TypeScript
79
star
36

vmpooler

Provide configurable 'pools' of instantly-available (running) virtual machines
Ruby
75
star
37

tasks-hands-on-lab

Deprecated: Please see http://bolt.guide to follow our Bolt tutorial!
Shell
73
star
38

puppetlabs-inifile

Resource types for managing settings in INI files
Ruby
70
star
39

hiera-puppet

Puppet function and data backend for Hiera
Ruby
60
star
40

leatherman

A collection of C++ and CMake utility libraries.
C++
57
star
41

puppet-rfc

Puppet RFC Repository
Ruby
55
star
42

puppetlabs-f5

Puppet Management of F5 Network Devices.
53
star
43

puppetlabs-puppetdb

A puppet module for installing and managing puppetdb
Ruby
52
star
44

relay

Event-driven workflows for DevOps automation
Go
52
star
45

puppetserver-helm-chart

The Helm Chart for Puppet Server
Mustache
51
star
46

puppetlabs-powershell

powershell provider for the Puppet exec resource type
Ruby
50
star
47

puppetlabs-rsync

rsync module
Ruby
49
star
48

puppet-agent

All of the directions for building a puppet agent package.
Ruby
48
star
49

homebrew-puppet

A tap for Puppet macOS package distribution
Ruby
45
star
50

pdk-templates

The main template repo for the Puppet Development Kit https://github.com/puppetlabs/pdk
HTML
43
star
51

docs-archive

An archive of old documentation for Puppet, PE, CD4PE, Pipelines, and their related components. No longer updated, for reference only.
HTML
42
star
52

puppet-editor-services

Puppet Language Server for editors
Ruby
41
star
53

puppetlabs-puppet_agent

Module for managing Puppet-Agent
Ruby
40
star
54

puppetlabs-tomcat

PuppetLabs Tomcat module
Ruby
38
star
55

kream

Kubernetes Rules Everything Around Me. A development environment for the Puppet/kubernetes module
Ruby
38
star
56

packaging

Packaging automation for Puppet software
Ruby
37
star
57

rubocop-i18n

RuboCop rules for detecting and autocorrecting undecorated strings for i18n (gettext and rails-i18n)
Ruby
36
star
58

nssm

Puppet fork of the NSSM source code from https://git.nssm.cc/nssm/nssm.git
C++
36
star
59

puppetlabs-java_ks

Uses a combination of keytool and openssl to manage entries in a Java keystore
Ruby
35
star
60

gatling-puppet-load-test

Scala
34
star
61

ruby-hocon

A Ruby port of the Typesafe Config library.
Ruby
34
star
62

netdev_stdlib

Netdev is a vendor-neutral network abstraction framework maintained by Puppet, Inc
Ruby
30
star
63

puppetlabs-sshkeys

Puppet Labs SSH Public Keys
Shell
30
star
64

puppetlabs-peadm

A Puppet module defining Bolt plans used to automate Puppet Enterprise deployments
Puppet
30
star
65

tasks-playground

Deprecated: Please check out https://bolt.guide to learn about Bolt, or see the project at https://github.com/puppetlabs/bolt
Shell
27
star
66

puppetlabs-node_encrypt

Encrypt secrets inside Puppet catalogs and reports
Ruby
27
star
67

structured-logging

Write data structures to your logs from clojure
Clojure
27
star
68

puppet-resource_api

This library provides a simple way to write new native resources for https://puppet.com.
Ruby
27
star
69

puppetlabs-reboot

Reboot type and provider
Ruby
26
star
70

vanagon

All of your packages will fit into this van with this one simple trick.
Ruby
26
star
71

vmfloaty

A CLI helper tool for Puppet vmpooler to help you stay afloat
Ruby
25
star
72

puppetlabs-registry

Puppet Module for managing the Windows Registry through custom types and providers
Ruby
25
star
73

puppet-syntax-emacs

Puppet language syntax highlighting for Emacs
Emacs Lisp
25
star
74

pxp-agent

PCP eXecution Protocol Agent
C++
22
star
75

puppetlabs-acl

ACL (Access Control List) module
Ruby
20
star
76

clj-i18n

Clojure i18n library and utilities
Clojure
20
star
77

puppetlabs-transition

Transition module
Ruby
20
star
78

puppetlabs-sslcertificate

Puppet module to manage SSL Certificates on WIndows Server 2008 and upwards
Ruby
20
star
79

puppetlabs-accounts

Account management module
Ruby
19
star
80

provision

Simple tasks to provision and tear_down containers / instances and virtual machines.
Ruby
19
star
81

cppbestpractices

Collection of C++ Best Practices at Puppet Labs
C++
19
star
82

clj-kitchensink

Library of utility functions for clojure
Clojure
19
star
83

jvm-ssl-utils

SSL certificate management on the JVM
Clojure
18
star
84

net_http_unix

AF_UNIX domain socket support on top of Ruby's Net::HTTP libraries
Ruby
18
star
85

design-system

A resource for creating user interfaces based on brand, UX, and dev principles
JavaScript
18
star
86

puppet-eucalyptus

Install and management tools for Eucalyptus built with Puppet
Puppet
17
star
87

puppet-classify

A ruby library to interface with the classifier service
Ruby
17
star
88

puppetdb-cli

PuppetDB CLI Tooling
Go
16
star
89

puppetlabs-rcfiles

Customizations for vim, shell, screen, ruby, etc... The goal is to quickly provide an efficient working environment.
Vim Script
16
star
90

puppetlabs-motd

Simple motd module
Ruby
16
star
91

relay-core

Kubernetes-based execution engine
Go
16
star
92

trapperkeeper-webserver-jetty9

Trapperkeeper webservice service (jetty9 implementation).
Clojure
16
star
93

clj-http-client

HTTP client library wrapping Apache HttpAsyncClient
Clojure
15
star
94

bolt-examples

Puppet
15
star
95

puppet-vro-starter_content

Shell
15
star
96

facter-ng

Collect and display system facts
Ruby
15
star
97

ruby-pwsh

A ruby gem for interacting with PowerShell
Ruby
15
star
98

cisco_ios

Cisco IOS Catalyst module
Ruby
14
star
99

learn-to-be-a-puppet-engineer

In this repository we map out skills that our PSE should have, we try link to existing documentation or blog posts, or if they don't exist, create it.
CSS
14
star
100

puppet-gatling-jenkins-plugin

A Jenkins plugin that extends the gatling library
HTML
14
star