Version information
This version is compatible with:
- , , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'jhoblitt-perlbrew', '0.4.0'
Learn more about managing modules with a PuppetfileDocumentation
Puppet perlbrew Module
Table of Contents
Overview
Manages perlbrew
based Perl5 installations
Description
This is a puppet module for basic management of
perlbrew
based Perl5 installations. It has the
ability to manage multiple parallel installations on the same host.
Several of the types in this module have parse order dependent behavior. Please observe any warning(s) listed in a type's description below
Usage
Examples
Single Perl Environment
perlbrew { '/home/moe':
owner => 'moe',
group => 'stoges',
bashrc => true,
}
perlbrew::perl { 'perl-5.20.1':
target => '/home/moe',
}
perlbrew::cpanm { 'Module::Build':
target => 'perl-5.20.1',
}
Multiple Perl Environments
perlbrew { '/home/moe':
owner => 'moe',
}
perlbrew { '/home/larry':
owner => 'larry',
}
perlbrew { '/home/curly':
owner => 'curly',
}
perlbrew::perl { 'moe-5.20.1':
target => '/home/moe',
version => 'perl-5.20.1',
}
perlbrew::perl { 'larry-5.20.1':
target => '/home/larry',
version => 'perl-5.20.1',
}
perlbrew::perl { 'curly-5.20.1':
target => '/home/curly',
version => 'perl-5.20.1',
}
perlbrew::cpanm { 'moe-Module::Build':
target => 'moe-5.20.1',
module => 'Module::Build',
}
perlbrew::cpanm { 'larry-Module::Build':
target => 'larry-5.20.1',
module => 'Module::Build',
}
perlbrew::cpanm { 'curly-Module::Build':
target => 'curly-5.20.1',
module => 'Module::Build',
}
Install Module from Git
perlbrew::cpanm { 'git@github.com:jhoblitt/DateTime-Format-ISO8601.git':
target => '5.20.1',
module => 'DateTime::Format::ISO8601',
}
Building an Application
Example of building a perl application in place.
$lockfile = "${app_root}/lock"
vcsrepo { $app_root:
ensure => present,
provider => 'git',
source => '',
user => $app_user,
owner => $app_user,
group => $app_group,
} ->
perlbrew::exec { 'perl Build.PL':
target => 'perl-5.20.1',
cwd => $app_root
creates => $lockfile,
require => Perlbrew::Cpanm['Module::Build'],
} ->
perlbrew::exec { 'Build':
target => 'perl-5.20.1',
cwd => $app_root,
path => $app_root,
creates => $lockfile,
} ->
perlbrew::exec { 'cpanm --installdeps --notest .':
target => 'perl-5.20.1',
path => ['/bin', '/usr/bin'],
cwd => $app_root,
creates => $lockfile,
timeout => 900,
} ->
file { $lockfile:
ensure => 'file',
owner => $app_user,
group => $app_group,
}
Defines
perlbrew
# defaults
perlbrew { '/home/foo':
install_root => '/home/foo', # defaults to resource title
owner => undef,
group => undef,
bashrc => false,
}
install_root
Absolute path. Defaults to $name
The root path of the perlbrew installation. Optional if the resource title is a unique absolute path.
owner
String
Defaults to undef
The user account that own's the perlbrew installation.
group
String
Defaults to undef
The group that own's the perlbrew installation.
bashrc
Boolean
Defaults to false
If set to true
, a line to source
the perlbrew bash init script is added to
the .bashrc
file located under the install
root. Eg.
source <source>/perl5/perlbrew/etc/bashrc
perlbrew::perl
Warning: This defined type has parse order dependent behavior. The
Perlbrew[$target]
resource must be parsed before this type's declaration.
perlbrew::perl { 'perl-5.20.1':
target => '/home/moe', # required
version => 'perl-5.20.1',
flags => "--notest -j ${::processorcount}",
timeout => 900,
}
target
String
Required
The name of the Perlbrew[...]
resource / environment the declared version of perl should be installed under.
version
String
Defaults to $title
The version string of perl 5 release to be installed. Eg.
$ perlbrew available
perl-5.20.1
perl-5.18.4
perl-5.16.3
perl-5.14.4
perl-5.12.5
perl-5.10.1
perl-5.8.9
perl-5.6.2
perl5.005_04
perl5.004_05
perl5.003_07
flags
String
Defaults to --notest -j ${::processorcount}
The option flag(s) passed to perlbrew install
command. Note that the
--notest
flag dramatically speeds up the ammount of time require to install a
perl version.
timeout
String
Defaults to 900
This sets the timeout on the perlbrew install
command. It may be nessicary
to increase this value on a slow host or if the --notest
flag is not being
passed.
perlbrew::cpanm
Warning: This defined type has parse order dependent behavior. The
Perlbrew::Perl[$target]
resource must be parsed before this type's
declaration.
perlbrew::cpanm { 'Module::Build':
target =>'perl-5.20.1', # required
module => 'Module::Build', # defaults to resource title
flags => '--notest',
check_name => undef,
timeout => undef,
}
target
String
Required
The name of the Perlbrew::Perl[...]
resource / perl installation to use.
module
String
Defaults to $title
The module name to pass to the cpanm
utility.
flags
String
Defaults to --notest
The set of flag(s), as a string, to pass to cpanm
.
check_name
String
Defaults to undef
The name of the install perl lib to test for. If left undef, $module/$title
is is tested for. This is useful is the name of the installed library does not
match the git url / cpan tarball name. Eg.
perlbrew::cpanm { 'https://github.com/Perl-Toolchain-Gang/Module-Build':
target =>'perl-5.20.1',
check_name => 'Module::Build',
}
timeout
String
Defaults to undef
The number of seconds the operation should wait before failing due to a timeout.
perlbrew::exec
Warning: This defined type has parse order dependent behavior. The
Perlbrew::Perl[$target]
resource must be parsed before this type's
declaration.
perlbrew::exec { 'perl Build.PL':
target => 'perl-5.20.1', # required
command => 'perl Build.PL',
creates => undef,
cwd => undef,
environment => undef,
logoutput => undef,
onlyif => undef,
path => undef,
provider => undef,
refresh => undef,
refreshonly => undef,
returns => undef,
timeout => undef,
tries => undef,
try_sleep => undef,
umask => undef,
unless => undef,
}
This defined type is a thin convenience wrapper around Puppet's core exec type.
target
String
Required
The name of the Perlbrew::Perl[...]
resource / perl installation to use.
Massaged parameters
Values passed to these parameters are merged with internal arrays before being
passed to the core exec
type.
environment
path
Passed through parameters
These parameters behave identically to Puppet's core exec
type:
command
creates
cwd
logoutput
onlyif
provider
refresh
refreshonly
returns
timeout
tries
try_sleep
umask
unless
Limitations
At present, this module is only capable of supporting one perlbrew::perl
installed perl version per perlbrew
environment. This is due to the logic
used in the perlbrew::perl
define for the perlbrew switch <version>
logic.
This should be relatively easy to change if one encounters that use case.
Tested Platforms
- el6.x
Versioning
This module is versioned according to the Semantic Versioning 2.0.0 specification.
Support
Please log tickets and issues at github
See Also
[Current]
- 768e006 - (Joshua Hoblitt) add sles/debian linux to operatingsystem_support metadata
- e055934 - (Joshua Hoblitt) update+add README examples
- b6ee28c - (Joshua Hoblitt) remove puppet 2.7.14 from travis matrix
- 96774ab - (Joshua Hoblitt) Merge pull request #2 from jhoblitt/feature/perlbrew_perl_params
Feature/perlbrew perl params
- 7b72c18 - (Joshua Hoblitt) add timeout param to perlbrew::perl
This change also shortens the default timeout on a perl install from 3600s -> 900s.
- de60e1f - (Joshua Hoblitt) add flags param to perlbrew::perl
The flags param defaults to including the --notest
flag which should
dramatically shorten the time required to install a new perl version.
- greatly improved test coverage of perlbrew::perl
v0.3.0
- c20ffd3 - (Joshua Hoblitt) bump version to v0.3.0
- c01f182 - (Joshua Hoblitt) Merge pull request #1 from jhoblitt/feature/cpanm_params
add timeout & flags params to perlbrew::cpanm
- 43b11f3 - (Joshua Hoblitt) add timeout & flags params to perlbrew::cpanm
v0.2.0
- 9c740e8 - (Joshua Hoblitt) bump version to v0.2.0
- 0d62542 - (Joshua Hoblitt) remove debugging comments from perlbrew::exec
Never should have been committed...
- 2a5b511 - (Joshua Hoblitt) set a default cwd for perlbrew::exec
This is to [hopefully] prevent the exec from having a cwd that the user/group perms it's running with doesn't have access to.
v0.1.0
- 3571557 - (Joshua Hoblitt) humans should never have to hand edit json...
- 796dd2b - (Joshua Hoblitt) add metadata.json for initial forge release
- ccf48cb - (Joshua Hoblitt) fix README example typo
- dc52547 - (Joshua Hoblitt) minor README markup fixes
- 66b32d4 - (Joshua Hoblitt) puppet < 3's exec type does not support the umask parameter
- c9e5b7b - (Joshua Hoblitt) do not prefix perlbrew perl version string with perl-
Require the full perlbrew version string
- c4d392d - (Joshua Hoblitt) fill out basic README structure
- c8e630b - (Joshua Hoblitt) perlbrew::exec should not be forced to Perlbrew[$target]'s cwd
- 6fe4729 - (Joshua Hoblitt) make rspec tests compatible with ruby 1.8.7 (again...)
- a837813 - (Joshua Hoblitt) add perlbrew::exec define
- refactor perlbrew::cpanm to use new define
- needs additional tests
- 64e61e3 - (Joshua Hoblitt) make rspec tests compatible with ruby 1.8.7
Remove trailing commas from the last hash key...
- b28b77d - (Joshua Hoblitt) change perlbrew install param to default to name/title
- 2f46366 - (Joshua Hoblitt) add perlbrew::cpanm define
- d1bcc7f - (Joshua Hoblitt) pedantically replicate perlbrew env vars for perlbrew::perl
- 1b59b58 - (Joshua Hoblitt) add perlbrew::perl define
- bd2db22 - (Joshua Hoblitt) set shell env HOME var when installing perlbrew
- 6353948 - (Joshua Hoblitt) first working version
- ac2c584 - (Joshua Hoblitt) first commit
Dependencies
- puppetlabs/stdlib (>= 3.2.0 < 5.0.0)
- maestrodev/wget (>= 1.2.2)
Copyright (C) 2014 Joshua Hoblitt <jhoblitt@cpan.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.