Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/system/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/system/sysvinit.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZmZmZmZmZmZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatustcoretsupported_bys%	
module: sysvinit
author:
    - "Ansible Core Team"
version_added: "2.6"
short_description:  Manage SysV services.
description:
    - Controls services on target hosts that use the SysV init system.
options:
    name:
        required: true
        description:
            - Name of the service.
        aliases: ['service']
    state:
        choices: [ 'started', 'stopped', 'restarted', 'reloaded' ]
        description:
            - C(started)/C(stopped) are idempotent actions that will not run commands unless necessary.
              Not all init scripts support C(restarted) nor C(reloaded) natively, so these will both trigger a stop and start as needed.
    enabled:
        type: bool
        description:
            - Whether the service should start on boot. B(At least one of state and enabled are required.)
    sleep:
        default: 1
        description:
            - If the service is being C(restarted) or C(reloaded) then sleep this many seconds between the stop and start command.
              This helps to workaround badly behaving services.
    pattern:
        description:
            - A substring to look for as would be found in the output of the I(ps) command as a stand-in for a status result.
            - If the string is found, the service will be assumed to be running.
            - "This option is mainly for use with init scripts that don't support the 'status' option."
    runlevels:
        description:
            - The runlevels this script should be enabled/disabled from.
            - Use this to override the defaults set by the package or init script itself.
    arguments:
        description:
            - Additional arguments provided on the command line that some init scripts accept.
        aliases: [ 'args' ]
    daemonize:
        type: bool
        description:
            - Have the module daemonize as the service itself might not do so properly.
            - This is useful with badly written init scripts or daemons, which
              commonly manifests as the task hanging as it is still holding the
              tty or the service dying when the task is over as the connection
              closes the session.
        default: no
notes:
    - One option other than name is required.
requirements:
    - That the service managed has a corresponding init script.
s
- name: make sure apache2 is started
  sysvinit:
      name: apache2
      state: started
      enabled: yes

- name: make sure apache2 is started on runlevels 3 and 5
  sysvinit:
      name: apache2
      state: started
      enabled: yes
      runlevels:
        - 3
        - 5
sz
results:
    description: results from actions taken
    returned: always
    type: complex
    sample: {
            "attempts": 1,
            "changed": true,
            "name": "apache2",
            "status": {
                "enabled": {
                    "changed": true,
                    "rc": 0,
                    "stderr": "",
                    "stdout": ""
                },
                "stopped": {
                    "changed": true,
                    "rc": 0,
                    "stderr": "",
                    "stdout": "Stopping web server: apache2.\n"
                }
            }
        }
N(tsleep(t
AnsibleModule(tsysv_is_enabledtget_sysv_scripttsysv_existstfail_if_missingtget_pst	daemonizec`sS
tdtdtdtddddg�dtd	d
ddd
gdd�dtdd�dtdddd�dtdd�dtddddg�dtdd�dtdddt��dtdddgg���jd��jd��jd}�jd}�jd}�jd}d}d}}i�d6td6id6}t�t����t���d d!d"d#g}d$d%d&dg}	i}
i}x'|	D]}�j|d'|�||<q�W|rxK|D]0}
|
j	|
i�t
�d(|
�|
|
d<q�Wnt
��|
d<t}t}|rFt�|�}}n�|jd�rld)|d�f}n#�rd*�}n�j
d+d,��j|�\}}}|d-ks��d.kr�d/|kr�t}t}n|r�|jd0�dkr�|j�j�j�d�}x3d1d2d3d4d5gD]}||kr*t}Pq*q*W|s�xBd6d7d8gD].}||kr`d9|kr`t}t}Pq`q`Wq�n|r�|dQkr�t}q�n|s|dkr�t}t}qt���rt}t}�jd>�qn|s�jd?�n|dj	di�t|ddd<d|ddd@<d|dddA<d|dddB<|r||ddd<xA|D]9}
||
|
dkr�t|d<t|ddd<q�q�W�jrB|drB|ry|jd%�r2�jdC|d%�dDj|�f�\}}}q|jd$�r�jdE|d$dj|��f�\}}}qq|jd%�r��jdF|d%�dDj|�f�\}}}q|jd$�r�jdG|d$dj|��f�\}}}qqBn;|dk	rB||
dkrBt|d<t|ddd<n�jrB|drB|r�|jd%�r��jdH|d%�f�\}}}q?|jd$�r?�jdI|d$�f�\}}}q?qB|jd%�r�jdJ|d%�f�\}}}qB|jd$�rB�jdK|d$�f�\}}}qBn�jr�|dddr�||ddd@<||dddA<||dddB<dR\}}}dL|dddBkr��j
d+dM�|�q�n|dj	�jdi�t|d�jdd<d|d�jdd@<d|d�jddA<d|d�jddB<�rB
tjdNd�j�������fdO�}�dPkr
	t|d<t|d�jdd<�js�	x?d1d7gD].}||�\}}}|r�t|�q�q�Wq�	n�|�d7kkrf	t|d<t|d�jdd<�js�	|��\}}}q�	nY|�d1kkr�	t|d<t|d�jdd<�js�	|��\}}}q�	n�jrB
|d�jddrB
||d�jdd@<||d�jddA<||d�jddB<dS\}}}qB
n�j|�dS(TNt
argument_spectnametrequiredttypetstrtaliasestservicetstatetchoiceststartedtstoppedt	restartedtreloadedtenabledtboolRtinttdefaultitpatternt	argumentstargst	runlevelstlistRtsupports_check_modetrequired_one_ofittchangedRs/sbins	/usr/sbins/bins/usr/bint	chkconfigsupdate-rc.dtinsservtopt_dirstrunlevels%s %s statuss	%s statustmsgs"Unable to determine service statusi����tiptablestACCEPTs
tstopsis dead s	dead but scould not access pid filetinactivetruntstarttactivesnot iiiiEsTUsed ps output to match service name and determine it is up, this is very unreliables9Unable to determine if service is up, assuming it is downtrctstdouttstderrs%s %s enable %st s%s --level %s %s ons%s %s disable %ss%s --level %s %s offs%s %s defaultss%s %s ons
%s %s disables	%s %s offsillegal runlevel specifieds=Illegal runlevel specified for enable operation on service %ssp?ed$c	`s��jd}d�||dkr(dn|f}�jdrZt�|�\}}}n�j|�\}}}|dkr��jdd��fd|d	|d
|�n|||fS(NR"s%s %s %sR(RiR.sFailed to %s service: %sR6R7R8(tparamstNoneRtrun_commandt	fail_json(tdoitR#tcmdR6toutterr(tactiontmoduleRtscript(sC/usr/lib/python2.7/site-packages/ansible/modules/system/sysvinit.pytrunme.s
%
/trestart(iiiiiE(NNN(NNN(R	tdicttTruetFalseR:R
RRtget_bin_patht
setdefaultR
RtgetR=R<tcounttlowertreplacetwarnR;t
check_modetjointretsubRt	exit_json(RR$R!t	sleep_forR6R@RAtresulttpathstbinariestrunlevel_statustlocationtbinarytrlt
is_startedtworkedR?tcleanoutRtstarted_statusREtdothis((RBRCRRDsC/usr/lib/python2.7/site-packages/ansible/modules/system/sysvinit.pytmainzs(!









!
		

585;
),),
	
	
	#t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRSttimeRtansible.module_utils.basicR	tansible.module_utils.serviceR
RRR
RRRct__name__(((sC/usr/lib/python2.7/site-packages/ansible/modules/system/sysvinit.pyt<module>s

9.	�

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]