Try to make dsa-check-hpssacli cron entry setup code easier to read
authorPeter Palfrader <peter@palfrader.org>
Tue, 13 Mar 2018 10:08:13 +0000 (11:08 +0100)
committerPeter Palfrader <peter@palfrader.org>
Tue, 13 Mar 2018 10:08:13 +0000 (11:08 +0100)
modules/hardware/manifests/raid/proliant.pp

index 7868e29..cd8afaa 100644 (file)
@@ -28,22 +28,18 @@ class hardware::raid::proliant {
                }
 
                if $::smartarraycontroller_hpsa {
                }
 
                if $::smartarraycontroller_hpsa {
-                       if $::hostname in [lobos,villa] {
-                               concat::fragment { 'dsa-puppet-stuff--nagios--dsa-check-hpssacli':
-                                       target => '/etc/cron.d/dsa-puppet-stuff',
-                                       order  => '020',
-                                       content  => @(EOF)
-                                               27 */2 * * * root sleep $(( $RANDOM \% 900 )); dsa-wrap-nagios-check dsa-check-hpssacli --no-battery
-                                               | EOF
-                               }
-                       } else {
-                               concat::fragment { 'dsa-puppet-stuff--nagios--dsa-check-hpssacli':
-                                       target => '/etc/cron.d/dsa-puppet-stuff',
-                                       order  => '020',
-                                       content  => @(EOF)
-                                               27 */2 * * * root sleep $(( $RANDOM \% 900 )); dsa-wrap-nagios-check dsa-check-hpssacli
-                                               | EOF
-                               }
+                       $cmd = $hostname ? {
+                               'lobos' => 'dsa-check-hpssacli --no-battery',
+                               'villa' => 'dsa-check-hpssacli --no-battery',
+                               default => 'dsa-check-hpssacli'
+                       }
+
+                       concat::fragment { 'dsa-puppet-stuff--nagios--dsa-check-hpssacli':
+                               target => '/etc/cron.d/dsa-puppet-stuff',
+                               order  => '020',
+                               content  => @("EOF")
+                                       27 */2 * * * root sleep $(( RANDOM \% 900 )); dsa-wrap-nagios-check ${cmd}
+                                       | EOF
                        }
                }
                file { '/etc/cron.d/puppet-nagios-hpsa': ensure => absent, }
                        }
                }
                file { '/etc/cron.d/puppet-nagios-hpsa': ensure => absent, }