nosh – Manage services with nosh¶
New in version 2.5.
Synopsis¶
Control running and enabled state for system-wide or user services.
BSD and Linux systems are supported.
Requirements¶
The below requirements are needed on the host that executes this module.
A system with an active nosh service manager, see Notes for further information.
Parameters¶
Notes¶
Note
Information on the nosh utilities suite may be found at https://jdebp.eu/Softwares/nosh/.
Examples¶
- name: start dnscache if not running
nosh: name=dnscache state=started
- name: stop mpd, if running
nosh: name=mpd state=stopped
- name: restart unbound or start it if not already running
nosh:
name: unbound
state: restarted
- name: reload fail2ban or start it if not already running
nosh:
name: fail2ban
state: reloaded
- name: disable nsd
nosh: name=nsd enabled=no
- name: for package installers, set nginx running state according to local enable settings, preset and reset
nosh: name=nginx preset=True state=reset
- name: reboot the host if nosh is the system manager, would need a "wait_for*" task at least, not recommended as-is
nosh: name=reboot state=started
- name: using conditionals with the module facts
tasks:
- name: obtain information on tinydns service
nosh: name=tinydns
register: result
- name: fail if service not loaded
fail: msg="The {{ result.name }} service is not loaded"
when: not result.status
- name: fail if service is running
fail: msg="The {{ result.name }} service is running"
when: result.status and result.status['DaemontoolsEncoreState'] == "running"
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
Thomas Caravia (@tacatac)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.