Services are defined as system daemons typically started with system init or rc scripts, services can be defined as running or dead.
httpd:
service.running: []
The service can also be set to be started at runtime via the enable option:
openvpn:
service.running:
- enable: True
By default if a service is triggered to refresh due to a watch statement the service is by default restarted. If the desired behavior is to reload the service, then set the reload value to True:
redis:
service.running:
- enable: True
- reload: True
- watch:
- pkg: redis
Note
More details regarding watch
can be found in the
Requisites documentation.
salt.states.service.
dead
(name, enable=None, sig=None, **kwargs)¶Ensure that the named service is dead by stopping the service if it is running
True
sets the service
to be enabled, False
sets the named service to be disabled. The
default is None
, which does not enable or disable anything.salt.states.service.
disabled
(name, **kwargs)¶Verify that the service is disabled on boot, only use this state if you don't want to manage the running process, remember that if you want to disable a service to use the enable: False option for the running or dead function.
salt.states.service.
enabled
(name, **kwargs)¶Verify that the service is enabled on boot, only use this state if you don't want to manage the running process, remember that if you want to enable a running service to use the enable: True option for the running or dead function.
salt.states.service.
mod_watch
(name, sfun=None, sig=None, reload=False, full_restart=False, force=False, **kwargs)¶The service watcher, called to invoke the watch command.
salt.states.service.
running
(name, enable=None, sig=None, **kwargs)¶Verify that the service is running