Ask Your Question
0

MySQL Package Name with different versions

asked 2016-08-28 23:39:52 -0500

sureshr7 gravatar image

updated 2016-08-29 13:44:17 -0500

Hi,

MySQL package names are different with different versions(5.1,5.6,5,7,mariadb...). How to handle this efficiently ? Do we write this on params.pp or init.pp ? Current forge module doesn't handle this problem.

My Question is little different. MySQL package names are different with different versions. 5.0/5.1 ---> MySQL-server-community 5.6 ----> MySQL-server 5.7 --->mysql-community-server

In the mysql module, How to derive these package names ? MySQL version is passed as hiera parameter. What is best place to find the package name based on mysql version ? I am just trying to figure out a way to handle this better. variable version is the deciding factor for the package names. I can pass this vie hiera. Is below the only approach to handle package names? If yes where to place this code ? init.pp or params.pp ?

if $mysqlprovider == 'mariadb' { $clientpackagename = 'MariaDB-client' $serverpackagename = 'MariaDB-server' $serverservicename = 'mysql' $develpackagename = 'MariaDB-devel' $sharedpackagename = 'MariaDB-shared' } else { $serverpackagename = $version ? { /^5.0|.1./ => 'MySQL-server-community', /^5.6./ => 'MySQL-server', /^5.7./ => 'mysql-community-server', default => 'mysql-community-server' } $clientpackagename = $version ? { /^5.0|.1./ => 'MySQL-client-community', /^5.6./ => 'MySQL-client', /^5.7./ => 'mysql-community-client', default => 'mysql-community-client' } $develpackagename = $version ? { /^5.0|.1./ => 'MySQL-devel-community', /^5.6./ => 'MySQL-devel', /^5.7./ => 'mysql-community-devel', default => 'mysql-community-devel' } $sharedpackagename = $version ? { /^5.0|.1./ => 'MySQL-shared-community', /^5.6./ => 'MySQL-shared', /^5.7./ => 'mysql-community-libs', default => 'mysql-community-libs' } $compatpackagename = $version ? { /^5.0|.1./ => 'MySQL-shared-compat', /^5.6./ => 'MySQL-shared-compat', /^5.7./ => 'mysql-community-libs-compat', default => 'mysql-community-libs-compat' } $serverservice_name = $version ? { /^5.0|.1./ => 'mysql', /^5.6./ => 'mysql', /^5.7./ => 'mysqld', default => 'mysqld' }

Should i place the logic in init.pp or params.pp ?

Thanks Suresh Rajagopal

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-08-29 09:18:11 -0500

scoffland gravatar image

I'm not sure I follow your question but will take a stab at it anyways.

If you are trying to install different versions of MariaDB on different servers then you can do something like this.

case $fqdn { #case could be on $operatingsystem, $operatingsystemmajrelease, etc
  'foo.com', 'bar.com': { $mariadb_version == '5.5' }
  'baz.com', 'bez.com': { $mariadb_version == '5.7' }
}
package { 'mariadb': ensure => $mariadb_version }

If you are trying to install mysql on some servers and mariadb on others then the variable set in your case statement would be $mysql_package followed by

package { $mysql_package : ensure => installed }

I hope this answered your question please add clarification about what you are trying to do.

edit flag offensive delete link more

Comments

I am just trying to figure out a way to handle package name better. version is the deciding factor for the package names. I can pass this vie hiera. Is below the only approach to handle package names? If yes where to place this code ? init.pp or params.pp ?

sureshr7 gravatar imagesureshr7 ( 2016-08-29 13:43:52 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2016-08-28 23:39:52 -0500

Seen: 66 times

Last updated: Aug 29 '16