Defined types
service_autorestart::generic
: Configures a service for auto-restart in a platform agnostic way.service_autorestart::systemd
: Manages the auto-restart (aka service recovery) for a SystemD service.service_autorestart::windows
: Manages the auto-restart (aka service recovery) for a Windows service.
Resource types
service_recovery
: Manages the Recovery/Failure settings for a Windows Service Autorequires: Puppet will auto-require the service resource with the same 'na
This is very simplistic and doesn't allow tweaking of the parmeters. If you need
to tweak settings, you'll need to declare the service_autorestart::windows
or service_autorestart::systemd
directly.
Manages the auto-restart (aka service recovery) for a SystemD service.
service_autorestart::systemd { 'puppet': }
service_autorestart::systemd { 'puppet':
delay => '90s',
}
service_autorestart::systemd { 'puppet':
path => '/usr/local/lib/systemd/system/puppet.service',
value => 'on-abort',
delay => '90s',
}
service_autorestart::systemd { 'puppet':
autonotify_path => false,
autonotify_systemctl_daemon_reload => false,
}
The following parameters are available in the service_autorestart::systemd
defined type.
Data type: String
Path to the systemd service file for this service
Default value: "/usr/lib/systemd/system/${title}.service"
Data type: String
The value of the Reset=
setting for the SystemD service.
https://www.freedesktop.org/software/systemd/man/systemd.service.html#Restart=
Default value: 'on-failure'
Data type: Optional[String]
The value of the ResetSec=
setting for the SystemD service.
https://www.freedesktop.org/software/systemd/man/systemd.service.html#RestartSec=
Default value: undef
Data type: Boolean
Flag to enable creating an automatic notify relationship between the File[$path] and the Ini settings to modify the Restart parameters. Even if enabled, the relationships are protected with a guard, so if File[$path] is not defined the relationship will not be created. This prevents errors in environments where these resources aren't managed by Puppet
Default value: true
Data type: Boolean
Flag to enable creating an automatic notify relationship between the 'systemctl daemon-reload' command and the Ini settings to modify the Restart parameters. The settings will be applied first and the notify the Class['systemd::systemctl::daemon_reload'] of changes. This is enabled by default but probably only useful if you use the camptocamp/systemd module. Even if enabled, the relationships are protected with a guard, so if Class['systemd::systemctl::daemon_reload'] is not defined the relationship will not be created. This prevents errors in environments where these resources aren't managed by Puppet or the camptocamp/systemd module is not used.
Default value: true
Manages the auto-restart (aka service recovery) for a Windows service.
service_autorestart::windows { 'puppet': }
service_autorestart::windows { 'puppet':
delay => 60000, # delay is in milliseconds
}
service_autorestart::windows { 'myservice':
action => 'reboot',
reboot_message => 'service "myservice" failed, rebooting',
}
service_autorestart::windows { 'myservice':
action => 'run_command',
command => 'msg "myservice failed, showing a popup so you know"',
}
The following parameters are available in the service_autorestart::windows
defined type.
Data type: Enum['noop', 'reboot', 'restart', 'run_command']
- 'noop' = take no action.
- 'reboot' = reboot the computer, displaying
reboot_message
before rebooting. - 'restart' = restart the service.
run_command
= executes thecommand
when the service fails
Default value: 'restart'
Data type: Integer[0]
Number of millisecondsseconds (positive number) to wait before restarting the service.
Default value: 1000
Data type: Integer[0]
Number of seconds to wait before resetting the "failed" count. Default: 86,400 = 1 day (Windows default).
Default value: 86400
Data type: Optional[String]
Message to display before rebooting the computer. This is only used when specifying
action => 'reboot'
Default value: undef
Data type: Optional[String]
Command to run on failure. This is only used when specifying an `action => 'command'.
Default value: undef
Manages the Recovery/Failure settings for a Windows Service Autorequires: Puppet will auto-require the service resource with the same 'name' as this resource.
The following properties are available in the service_recovery
type.
Data type: Integer[0]
Number of seconds to wait before resetting the "failed" count. Default: 86,400 = 1 day (Windows default).
Default value: 86400
Data type: Optional[String]
Message to display before rebooting the computer. This only matters if you use a "failure_action" with an "action" of "reboot".
Data type: Optional[String]
Command to run on failure. This only matters if you use a "failure_action" with an
"action" of "run_command". Note: Windows uses the same command for each failure,
you can not specify a unique command per-failure.'
Data type: Array[Struct[{action => Enum["noop", "reboot", "restart", "run_command"], delay => Integer[0]} ], 0, 3]
List of actions to perform when the service fails. This takes two parameters "action",
the type of action to execute. Action "noop" means take no action. Action "reboot"
means reboot the computer display the "reboot_message" prior to rebooting. Action
"restart" means restart the service. Action "run_command" executes the "command"
when the service fails. The "delay" parameter is measure in milliseconds. The maximum
size of this array is 3.'
Default value: []
The following parameters are available in the service_recovery
type.
namevar
Data type: String[1]
Name of the service.