Skip to content

Latest commit

 

History

History
265 lines (165 loc) · 7.01 KB

REFERENCE.md

File metadata and controls

265 lines (165 loc) · 7.01 KB

Reference

Table of Contents

Defined types

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

Defined types

service_autorestart::generic

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.

service_autorestart::systemd

Manages the auto-restart (aka service recovery) for a SystemD service.

Examples

Basic usage
service_autorestart::systemd { 'puppet': }
Customize the delay between restarts
service_autorestart::systemd { 'puppet':
  delay => '90s',
}
Customize the path and when action restarts
service_autorestart::systemd { 'puppet':
  path  => '/usr/local/lib/systemd/system/puppet.service',
  value => 'on-abort',
  delay => '90s',
}
Disable auto-notify relationships
service_autorestart::systemd { 'puppet':
  autonotify_path                    => false,
  autonotify_systemctl_daemon_reload => false,
}

Parameters

The following parameters are available in the service_autorestart::systemd defined type.

path

Data type: String

Path to the systemd service file for this service

Default value: "/usr/lib/systemd/system/${title}.service"

value

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'

delay

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

autonotify_path

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

autonotify_systemctl_daemon_reload

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

service_autorestart::windows

Manages the auto-restart (aka service recovery) for a Windows service.

Examples

Auto-restart the Puppet service
service_autorestart::windows { 'puppet': }
Delay restarting the service for 60 seconds.
service_autorestart::windows { 'puppet':
  delay => 60000,  # delay is in milliseconds
}
Reboot the computer when the service fails
service_autorestart::windows { 'myservice':
  action         => 'reboot',
  reboot_message => 'service "myservice" failed, rebooting',
}
Run a command when the service fails
service_autorestart::windows { 'myservice':
  action  => 'run_command',
  command => 'msg "myservice failed, showing a popup so you know"',
}

Parameters

The following parameters are available in the service_autorestart::windows defined type.

action

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 the command when the service fails

Default value: 'restart'

delay

Data type: Integer[0]

Number of millisecondsseconds (positive number) to wait before restarting the service.

Default value: 1000

reset_period

Data type: Integer[0]

Number of seconds to wait before resetting the "failed" count. Default: 86,400 = 1 day (Windows default).

Default value: 86400

reboot_message

Data type: Optional[String]

Message to display before rebooting the computer. This is only used when specifying action => 'reboot'

Default value: undef

command

Data type: Optional[String]

Command to run on failure. This is only used when specifying an `action => 'command'.

Default value: undef

Resource types

service_recovery

Manages the Recovery/Failure settings for a Windows Service Autorequires: Puppet will auto-require the service resource with the same 'name' as this resource.

Properties

The following properties are available in the service_recovery type.

reset_period

Data type: Integer[0]

Number of seconds to wait before resetting the "failed" count. Default: 86,400 = 1 day (Windows default).

Default value: 86400

reboot_message

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".

command

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.'
failure_actions

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: []

Parameters

The following parameters are available in the service_recovery type.

name

namevar

Data type: String[1]

Name of the service.