changeset 402:76d18a918e7f

Switch to more parameters Avoids: * Hard-coding values that need to match other modules across OSes * Using templates when we can use param classes with conditional definitions
author IBBoard <dev@ibboard.co.uk>
date Wed, 20 Apr 2022 19:24:53 +0100
parents f0ee7a16125d
children a0c1b33a243f
files manifests/templates.pp modules/website/manifests/php.pp
diffstat 2 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/manifests/templates.pp	Wed Apr 20 19:13:24 2022 +0100
+++ b/manifests/templates.pp	Wed Apr 20 19:24:53 2022 +0100
@@ -529,9 +529,10 @@
 	else {
 		fail("No MySQL support for ${operatingsystem}")
 	}
+	include ::defaultusers::params
 	class { 'website::mysql':
-		mysqluser => template('defaultusers/mysql-user'),
-		mysqlpassword => template('defaultusers/mysql-password'),
+		mysqluser => $::defaultusers::params::mysql_user,
+		mysqlpassword => $::defaultusers::params::mysql_password,
 		mysqlprefix => $mysqlpackage,
 		mysqlsuffix => $mysqlsuffix,
 		phpsuffix => $php_suffix,
@@ -776,7 +777,7 @@
 	}
 	cron { 'owncloudcron':
 		command => "/usr/local/bin/owncloud-cron",
-		user => $pim_user,
+		user => $apache::params::user,
 		minute => '*/15',
 	}
 }
--- a/modules/website/manifests/php.pp	Wed Apr 20 19:13:24 2022 +0100
+++ b/modules/website/manifests/php.pp	Wed Apr 20 19:24:53 2022 +0100
@@ -3,15 +3,12 @@
     $module = undef,
     $extras = [],
     ) {
+  include ::apache::params
   if $osfamily == 'RedHat' {
-    $listener_user = 'apache'
-    $listener_group = 'apache'
     # Work around SELinux "denied execmem" warnings from preg_match JITing
     $pcre_jit = 0
   }
   else {
-    $listener_user = 'www-data'
-    $listener_group = 'www-data'
     $pcre_jit = 1
   }
   class { '::php':
@@ -20,9 +17,9 @@
     fpm => true,
     fpm_pools => {
       'www' => {
-        'listen_owner' => $listener_user,
-        'listen_group' => $listener_group,
         'listen' => '/run/php/php-fpm.sock',
+        'listen_owner' => $::apache::params::user,
+        'listen_group' => $::apache::params::group,
         'slowlog' => '/var/log/php-fpm/www-slow.log',
         'security_limit_extensions' => ['.php', '.html'],
         'php_admin_value' => {