Puppet Class: psick::nodejs
- Defined in:
- manifests/nodejs.pp
Summary
This class manages nodejs either via system packages or via NVMOverview
The class allows full management of nodejs
psick::nodejs::nvm_manage: true psick::nodejs::nvm_installs:
mastermonkey:
node_instance_default: '8.12.0'
npm_packages:
yarn: {}
pm2:
version: 2.10.4
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'manifests/nodejs.pp', line 47
class psick::nodejs (
String $ensure = 'present',
Boolean $package_manage = false,
String $package_name = 'nodejs',
Hash $package_params = {},
Boolean $setup_script_manage = false,
String $setup_script_url = 'https://rpm.nodesource.com/setup_10.x',
String $setup_script_path = '/tmp/NodeJS',
Hash $setup_script_params = {},
String $setup_script_creates = '', # lint:ignore:params_empty_string_assignment
Boolean $nvm_manage = false,
Hash $nvm_installs = {},
) {
# Setup script management
if $setup_script_manage {
archive { $setup_script_path:
ensure => $ensure,
source => $setup_script_url,
extract => false,
checksum_type => 'none',
cleanup => false,
before => Package[$package_name],
notify => Exec['nodejs setup'],
}
$setup_script_default_params = {
command => "/bin/bash ${setup_script_path} > njs_setup.txt",
creates => $setup_script_creates,
}
exec { 'nodejs setup':
* => $setup_script_default_params + $setup_script_params,
}
}
# Package management
if $package_manage {
$package_defaults = {
ensure => $ensure,
}
package { $package_name:
* => $package_defaults + $package_params,
}
}
$nvm_installs.each | $k,$v | {
psick::nodejs::nvm { $k:
* => $v,
}
}
}
|