Forge Home

ebs

Attach and partition EBS volumes

14,396 downloads

7,489 latest version

2.7 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.3.1 (latest)
  • 0.3.0
  • 0.2.2
  • 0.2.1
  • 0.2.0
  • 0.1.5
  • 0.1.4
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Feb 19th 2016

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'ignis-ebs', '0.3.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add ignis-ebs
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install ignis-ebs --version 0.3.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

ignis/ebs — version 0.3.1 Feb 19th 2016

ebs

Table of Contents

  1. Overview
  2. Usage - Configuration options and additional functionality
  3. Limitations - OS compatibility, etc.

Overview

This module provides allows to manage EBS volumes (attach, format, mount). Volumes should be created outside of puppet, for example, using CloudFormation. The module performs a lookup searching for a volume in question by a 'name' tag's value.

All the interactions with AWS API are performed with aws commandline utilities.

Usage

Be sure to create a volume beforehand. E.g., here is a snippet for CloudFormation:

"JenkinsMasterStorageVolume": {
  "Type": "AWS::EC2::Volume",
  "Properties": {
    "Encrypted": true,
    "AvailabilityZone": "eu-west-1a",
    "Size": 100,
    "Tags": [
      {
        "Key": "name",
        "Value": "jenkins"
      }
    ]
  }
},

Or awscli:

aws ec2 create-volume --availability-zone $${AWS_DEFAULT_REGION}a \
  --size 1 --encrypted --volume-type standard \
  --query '{id:VolumeId}' \
  | grep '"id"' | awk '{print $$2}' \
  | tr -d '"' | perl -pe chomp > .volume_id
aws ec2 create-tags --resources `cat .volume_id` \
  --tags Key=name,Value=jenkins

And then in your puppet code you can create resources like this:

ebs::volume { 'jenkins':              # so we look for an EBS volume that has name:jenkins tag set
  device          => '/dev/sdz',      # it is safer to begin with sdz and go backwards alphabetically
  device_attached => '/dev/xvdad'     # hard to guess -- see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
  format          => 'ext4',          # ext3 by default
  format_options  => '-L jenkins',    # this will be passed to mkfs.ext3 AS IS, string format
  mount_dir       => '/mnt/jenkins',  # /mnt by default
  mount_options   => 'nodev, noatime' # single string, fstab format, 'noatime' by default
}

mount_dir directory will be created if it doesn't exist (so manage it outside of this module to ensure custom owner/group/mode parameters).

Also, please be very careful with format option: if a volume was already formatted with, say, 'ext4' and you set this parameter to something else ( ext3 ) -- a volume will be reformatted and you will lose your data.

Limitations

This module was tested on CentOS 6.x and Ubuntu so far. For the AWS API authorization to work, you have to assign a proper IAM role to an ec2 instance you're running this code on. Example policy (tune Resource parameter to your liking):

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1444046341000",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeVolumes",
                "ec2:AttachVolume"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}