H Guys,
I'm kind of new to puppet and programming I've made a few simpler modules so far but i'm trying to expand and build them better and i think i'm hitting my "i don't get programming logic bar".
For example i'm trying to build a module that will take parameters such as php_version=variable and based on that i can install either php 5.3 5.4 or 5.5 and the necessary yum repo's.
I'm not getting anywhere and was wandering if my case logic and how i request the variable is correct .
I cannot get to where it just installs the packages i need based on php_version.
Thank you!
Bogdan
site.pp(node)
$php_version='php55'
include php
php/init.pp
class php {
include php::install
include php::params
}
php/params.pp
class php::params {
case $php_version {
'php55': {
$installrepo = "remi-php55"
$package_prefix ="php55"
}
'php54': {
$installrepo = "remi"
$package_prefix ="php54"
}
'php53': {
$installrepo = "epel"
$package_prefix ="php"
}
}
}
php/install.pp
class php::install {
include php::params
$packlist = [ "$package_prefix", "$package_prefix-gd", "$package_prefix-pear", "$package_prefix-devel", "$package_prefix-bcmath", "$package_prefix-cli", "$package_prefix-fpm", "$package_prefix-imap", "$package_prefix-mbstring", "$package_prefix-mcrypt", "$package_prefix-mysql", "$package_prefix-pdo", "$package_prefix-pecl-apc", "$package_prefix-pecl-memcache", "$package_prefix-pecl-memcached", "$package_prefix-pecl-sphinx", "$package_prefix-soap", "$package_prefix-xml" ]
package { "$packlist":
ensure => "latest",
}
}