Defined Type: foreman::rake

Defined in:
manifests/rake.pp

Summary

Run a Foreman rake task when notified

Overview

Parameters:

  • environment (Hash[String, String]) (defaults to: {})

    Environment variables to set

  • timeout (Optional[Integer[0]]) (defaults to: undef)

    The timeout to set on the exec resource

  • user (String[1]) (defaults to: $foreman::user)

    The user to run this rake task

  • app_root (Stdlib::Absolutepath) (defaults to: $foreman::app_root)

    The application root to use

  • unless (Variant[Undef, String[1], Array[String[1]]]) (defaults to: undef)

    Don’t execute the rake task if this command passes. If not passed in, the exec is refreshonly.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'manifests/rake.pp', line 14

define foreman::rake (
  Hash[String, String] $environment = {},
  Optional[Integer[0]] $timeout  = undef,
  String[1] $user = $foreman::user,
  Stdlib::Absolutepath $app_root = $foreman::app_root,
  Variant[Undef, String[1], Array[String[1]]] $unless = undef,
) {
  exec { "foreman-rake-${title}":
    command     => "/usr/sbin/foreman-rake ${title}",
    user        => $user,
    environment => sort(join_keys_to_values({ 'HOME' => $app_root } + $environment, '=')),
    logoutput   => true,
    refreshonly => $unless =~ Undef,
    timeout     => $timeout,
    unless      => $unless,
  }
}