??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
ó
àUdac @` s d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l m Z d d
l
m Z d d l m Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z e d k rþ e ƒ n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys]
---
module: nosh
author:
- "Thomas Caravia (@tacatac)"
version_added: "2.5"
short_description: Manage services with nosh
description:
- Control running and enabled state for system-wide or user services.
- BSD and Linux systems are supported.
options:
name:
required: true
description:
- Name of the service to manage.
state:
required: false
choices: [ started, stopped, reset, restarted, reloaded ]
description:
- C(started)/C(stopped) are idempotent actions that will not run
commands unless necessary.
C(restarted) will always bounce the service.
C(reloaded) will send a SIGHUP or start the service.
C(reset) will start or stop the service according to whether it is
enabled or not.
enabled:
required: false
type: bool
description:
- Enable or disable the service, independently of C(*.preset) file
preference or running state. Mutually exclusive with I(preset). Will take
effect prior to I(state=reset).
preset:
required: false
type: bool
description:
- Enable or disable the service according to local preferences in *.preset files.
Mutually exclusive with I(enabled). Only has an effect if set to true. Will take
effect prior to I(state=reset).
user:
required: false
default: 'no'
type: bool
description:
- Run system-control talking to the calling user's service manager, rather than
the system-wide service manager.
requirements:
- A system with an active nosh service manager, see Notes for further information.
notes:
- Information on the nosh utilities suite may be found at U(https://jdebp.eu/Softwares/nosh/).
s—
- 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"
sì
name:
description: name used to find the service
returned: success
type: str
sample: "sshd"
service_path:
description: resolved path for the service
returned: success
type: str
sample: "/var/sv/sshd"
enabled:
description: whether the service is enabled at system bootstrap
returned: success
type: bool
sample: True
preset:
description: whether the enabled status reflects the one set in the relevant C(*.preset) file
returned: success
type: bool
sample: 'False'
state:
description: service process run state, C(None) if the service is not loaded and will not be started
returned: if state option is used
type: str
sample: "reloaded"
status:
description: a dictionary with the key=value pairs returned by `system-control show-json` or C(None) if the service is not loaded
returned: success
type: complex
contains:
After:
returned: success
type: list
sample: ["/etc/service-bundles/targets/basic","../sshdgenkeys", "log"]
Before:
returned: success
type: list
sample: ["/etc/service-bundles/targets/shutdown"]
Conflicts:
returned: success
type: list
sample: '[]'
DaemontoolsEncoreState:
returned: success
type: str
sample: "running"
DaemontoolsState:
returned: success
type: str
sample: "up"
Enabled:
returned: success
type: bool
sample: True
LogService:
returned: success
type: str
sample: "../cyclog@sshd"
MainPID:
returned: success
type: int
sample: 661
Paused:
returned: success
type: bool
sample: 'False'
ReadyAfterRun:
returned: success
type: bool
sample: 'False'
RemainAfterExit:
returned: success
type: bool
sample: 'False'
Required-By:
returned: success
type: list
sample: '[]'
RestartExitStatusCode:
returned: success
type: int
sample: '0'
RestartExitStatusNumber:
returned: success
type: int
sample: '0'
RestartTimestamp:
returned: success
type: int
sample: 4611686019935648081
RestartUTCTimestamp:
returned: success
type: int
sample: 1508260140
RunExitStatusCode:
returned: success
type: int
sample: '0'
RunExitStatusNumber:
returned: success
type: int
sample: '0'
RunTimestamp:
returned: success
type: int
sample: 4611686019935648081
RunUTCTimestamp:
returned: success
type: int
sample: 1508260140
StartExitStatusCode:
returned: success
type: int
sample: 1
StartExitStatusNumber:
returned: success
type: int
sample: '0'
StartTimestamp:
returned: success
type: int
sample: 4611686019935648081
StartUTCTimestamp:
returned: success
type: int
sample: 1508260140
StopExitStatusCode:
returned: success
type: int
sample: '0'
StopExitStatusNumber:
returned: success
type: int
sample: '0'
StopTimestamp:
returned: success
type: int
sample: 4611686019935648081
StopUTCTimestamp:
returned: success
type: int
sample: 1508260140
Stopped-By:
returned: success
type: list
sample: ["/etc/service-bundles/targets/shutdown"]
Timestamp:
returned: success
type: int
sample: 4611686019935648081
UTCTimestamp:
returned: success
type: int
sample: 1508260140
Want:
returned: success
type: str
sample: "nothing"
Wanted-By:
returned: success
type: list
sample: ["/etc/service-bundles/targets/server","/etc/service-bundles/targets/sockets"]
Wants:
returned: success
type: list
sample: ["/etc/service-bundles/targets/basic","../sshdgenkeys"]
user:
description: whether the user-level service manager is called
returned: success
type: bool
sample: False
N( t
AnsibleModule( t fail_if_missing( t to_nativec C` sF | j d d t ƒg } | j d r5 | d g } n | j | | ƒ S( Ns system-controlt requiredt users --user( t get_bin_patht Truet paramst run_command( t modulet argst sys_ctl( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/nosh.pyt run_sys_ctl" s
c C` sW t | d | g ƒ \ } } } | d k rC t | t | d d ƒn t | ƒ j ƒ Sd S( Nt findi t msgt host( R R t FalseR
t strip( R t servicet rct outt err( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/nosh.pyt get_service_path) s c C` s( t | d | g ƒ \ } } } | d k S( Ns
is-enabledi ( R ( R t service_pathR R R ( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/nosh.pyt service_is_enabled2 s c C` s: t | d d | g ƒ \ } } } t | ƒ j ƒ j d ƒ S( Nt presets --dry-runt enable( R R
R t
startswith( R R R R R ( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/nosh.pyt service_is_preset_enabled7 s !c C` s( t | d | g ƒ \ } } } | d k S( Ns is-loadedi ( R ( R R R R R ( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/nosh.pyt service_is_loaded< s c C` sp t | d | g ƒ \ } } } | d k rC | rC | j d | ƒ n) t j t | ƒ j ƒ ƒ } | | } | Sd S( Ns show-jsonR ( R t Nonet fail_jsont jsont loadsR
R ( R R R R R t json_outR ( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/nosh.pyt get_service_statusA s
c C` s | d t d d d g ƒ k S( Nt DaemontoolsEncoreStatet startingt startedt running( t set( t service_status( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/nosh.pyt service_is_runningL s c C` s€ | d } | d } | j d rº d } | | j d k rº t | d <| j sž t | | | g ƒ \ } } } | d k rž | j d d | | | | f ƒ qž n | | d <| | d