Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZmZmZddlmZd�Zd�Zd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatustcoretsupported_bysz

module: systemd
author:
    - Ansible Core Team
version_added: "2.2"
short_description:  Manage services
description:
    - Controls systemd services on remote hosts.
options:
    name:
        description:
            - Name of the service. This parameter takes the name of exactly one service to work with.
            - When using in a chroot environment you always need to specify the full name i.e. (crond.service).
        aliases: [ service, unit ]
    state:
        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 always reload.
        choices: [ reloaded, restarted, started, stopped ]
    enabled:
        description:
            - Whether the service should start on boot. B(At least one of state and enabled are required.)
        type: bool
    force:
        description:
            - Whether to override existing symlinks.
        type: bool
        version_added: 2.6
    masked:
        description:
            - Whether the unit should be masked or not, a masked unit is impossible to start.
        type: bool
    daemon_reload:
        description:
            - Run daemon-reload before doing any other operations, to make sure systemd has read any changes.
            - When set to C(yes), runs daemon-reload even if the module does not start or stop anything.
        type: bool
        default: no
        aliases: [ daemon-reload ]
    daemon_reexec:
        description:
            - Run daemon_reexec command before doing any other operations, the systemd manager will serialize the manager state.
        type: bool
        default: no
        aliases: [ daemon-reexec ]
        version_added: "2.8"
    user:
        description:
            - (deprecated) run ``systemctl`` talking to the service manager of the calling user, rather than the service manager
              of the system.
            - This option is deprecated and will eventually be removed in 2.11. The ``scope`` option should be used instead.
        type: bool
        default: no
    scope:
        description:
            - run systemctl within a given service manager scope, either as the default system scope (system),
              the current user's scope (user), or the scope of all users (global).
            - "For systemd to work with 'user', the executing user must have its own instance of dbus started (systemd requirement).
              The user dbus process is normally started during normal login, but not during the run of Ansible tasks.
              Otherwise you will probably get a 'Failed to connect to bus: no such file or directory' error."
        choices: [ system, user, global ]
        version_added: "2.7"
    no_block:
        description:
            - Do not synchronously wait for the requested operation to finish.
              Enqueued job will continue without Ansible blocking on its completion.
        type: bool
        default: no
        version_added: "2.3"
notes:
    - Since 2.4, one of the following options is required 'state', 'enabled', 'masked', 'daemon_reload', ('daemon_reexec' since 2.8),
      and all except 'daemon_reload' (and 'daemon_reexec' since 2.8) also require 'name'.
    - Before 2.4 you always required 'name'.
    - Globs are not supported in name, i.e ``postgres*.service``.
requirements:
    - A system managed by systemd.
so
- name: Make sure a service is running
  systemd:
    state: started
    name: httpd

- name: stop service cron on debian, if running
  systemd:
    name: cron
    state: stopped

- name: restart service cron on centos, in all cases, also issue daemon-reload to pick up config changes
  systemd:
    state: restarted
    daemon_reload: yes
    name: crond

- name: reload service httpd, in all cases
  systemd:
    name: httpd
    state: reloaded

- name: enable service httpd and ensure it is not masked
  systemd:
    name: httpd
    enabled: yes
    masked: no

- name: enable a timer for dnf-automatic
  systemd:
    name: dnf-automatic.timer
    state: started
    enabled: yes

- name: just force systemd to reread configs (2.4 and above)
  systemd:
    daemon_reload: yes

- name: just force systemd to re-execute itself (2.8 and above)
  systemd:
    daemon_reexec: yes
sC
status:
    description: A dictionary with the key=value pairs returned from `systemctl show`
    returned: success
    type: complex
    sample: {
            "ActiveEnterTimestamp": "Sun 2016-05-15 18:28:49 EDT",
            "ActiveEnterTimestampMonotonic": "8135942",
            "ActiveExitTimestampMonotonic": "0",
            "ActiveState": "active",
            "After": "auditd.service systemd-user-sessions.service time-sync.target systemd-journald.socket basic.target system.slice",
            "AllowIsolate": "no",
            "Before": "shutdown.target multi-user.target",
            "BlockIOAccounting": "no",
            "BlockIOWeight": "1000",
            "CPUAccounting": "no",
            "CPUSchedulingPolicy": "0",
            "CPUSchedulingPriority": "0",
            "CPUSchedulingResetOnFork": "no",
            "CPUShares": "1024",
            "CanIsolate": "no",
            "CanReload": "yes",
            "CanStart": "yes",
            "CanStop": "yes",
            "CapabilityBoundingSet": "18446744073709551615",
            "ConditionResult": "yes",
            "ConditionTimestamp": "Sun 2016-05-15 18:28:49 EDT",
            "ConditionTimestampMonotonic": "7902742",
            "Conflicts": "shutdown.target",
            "ControlGroup": "/system.slice/crond.service",
            "ControlPID": "0",
            "DefaultDependencies": "yes",
            "Delegate": "no",
            "Description": "Command Scheduler",
            "DevicePolicy": "auto",
            "EnvironmentFile": "/etc/sysconfig/crond (ignore_errors=no)",
            "ExecMainCode": "0",
            "ExecMainExitTimestampMonotonic": "0",
            "ExecMainPID": "595",
            "ExecMainStartTimestamp": "Sun 2016-05-15 18:28:49 EDT",
            "ExecMainStartTimestampMonotonic": "8134990",
            "ExecMainStatus": "0",
            "ExecReload": "{ path=/bin/kill ; argv[]=/bin/kill -HUP $MAINPID ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }",
            "ExecStart": "{ path=/usr/sbin/crond ; argv[]=/usr/sbin/crond -n $CRONDARGS ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }",
            "FragmentPath": "/usr/lib/systemd/system/crond.service",
            "GuessMainPID": "yes",
            "IOScheduling": "0",
            "Id": "crond.service",
            "IgnoreOnIsolate": "no",
            "IgnoreOnSnapshot": "no",
            "IgnoreSIGPIPE": "yes",
            "InactiveEnterTimestampMonotonic": "0",
            "InactiveExitTimestamp": "Sun 2016-05-15 18:28:49 EDT",
            "InactiveExitTimestampMonotonic": "8135942",
            "JobTimeoutUSec": "0",
            "KillMode": "process",
            "KillSignal": "15",
            "LimitAS": "18446744073709551615",
            "LimitCORE": "18446744073709551615",
            "LimitCPU": "18446744073709551615",
            "LimitDATA": "18446744073709551615",
            "LimitFSIZE": "18446744073709551615",
            "LimitLOCKS": "18446744073709551615",
            "LimitMEMLOCK": "65536",
            "LimitMSGQUEUE": "819200",
            "LimitNICE": "0",
            "LimitNOFILE": "4096",
            "LimitNPROC": "3902",
            "LimitRSS": "18446744073709551615",
            "LimitRTPRIO": "0",
            "LimitRTTIME": "18446744073709551615",
            "LimitSIGPENDING": "3902",
            "LimitSTACK": "18446744073709551615",
            "LoadState": "loaded",
            "MainPID": "595",
            "MemoryAccounting": "no",
            "MemoryLimit": "18446744073709551615",
            "MountFlags": "0",
            "Names": "crond.service",
            "NeedDaemonReload": "no",
            "Nice": "0",
            "NoNewPrivileges": "no",
            "NonBlocking": "no",
            "NotifyAccess": "none",
            "OOMScoreAdjust": "0",
            "OnFailureIsolate": "no",
            "PermissionsStartOnly": "no",
            "PrivateNetwork": "no",
            "PrivateTmp": "no",
            "RefuseManualStart": "no",
            "RefuseManualStop": "no",
            "RemainAfterExit": "no",
            "Requires": "basic.target",
            "Restart": "no",
            "RestartUSec": "100ms",
            "Result": "success",
            "RootDirectoryStartOnly": "no",
            "SameProcessGroup": "no",
            "SecureBits": "0",
            "SendSIGHUP": "no",
            "SendSIGKILL": "yes",
            "Slice": "system.slice",
            "StandardError": "inherit",
            "StandardInput": "null",
            "StandardOutput": "journal",
            "StartLimitAction": "none",
            "StartLimitBurst": "5",
            "StartLimitInterval": "10000000",
            "StatusErrno": "0",
            "StopWhenUnneeded": "no",
            "SubState": "running",
            "SyslogLevelPrefix": "yes",
            "SyslogPriority": "30",
            "TTYReset": "no",
            "TTYVHangup": "no",
            "TTYVTDisallocate": "no",
            "TimeoutStartUSec": "1min 30s",
            "TimeoutStopUSec": "1min 30s",
            "TimerSlackNSec": "50000",
            "Transient": "no",
            "Type": "simple",
            "UMask": "0022",
            "UnitFileState": "enabled",
            "WantedBy": "multi-user.target",
            "Wants": "system.slice",
            "WatchdogTimestampMonotonic": "0",
            "WatchdogUSec": "0",
        }
N(t
AnsibleModule(t	is_chroot(tsysv_existstsysv_is_enabledtfail_if_missing(t	to_nativecC`s|dtddg�kS(NtActiveStatetactivet
activating(tset(tservice_status((sB/usr/lib/python2.7/site-packages/ansible/modules/system/systemd.pytis_running_servicescC`s|dtdg�kS(NRtdeactivating(R(R((sB/usr/lib/python2.7/site-packages/ansible/modules/system/systemd.pytis_deactivating_servicescC`s"d|ko!d|kp!d|kS(Nt=signoring requestsignoring command((tout((sB/usr/lib/python2.7/site-packages/ansible/modules/system/systemd.pytrequest_was_ignoredscC`si}g}d}x�|D]�}|dkr�d|kr|jdd�\}}|jd�r�|j�jd�r�|j�jd�s�|j|�qq�n|j�||<d}qq|j|�|j�jd�rdj|�j�||<g}d}qqW|S(NRitExect{t}s
(	tNonetsplitt
startswithtlstriptrstriptendswithtappendtstriptjoin(tlinestparsedtmultivaltktlinetv((sB/usr/lib/python2.7/site-packages/ansible/modules/system/systemd.pytparse_systemctl_shows&

$
	

cC`st
tdtdtdddddg�dtddd	d
ddd
g�dtdd�dtdd�dtdd�dtdddtddg�dtdddtddg�dtdd�dtddd	dddg�dtdddt��
dtddddddggdtddaddbddc�dddgg�}|jd}|dk	r�x:ddD]/}||kra|jd#d$||f�qaqaWn|jd%t�}tj	d&�dkr�d'tj
�tjd&<n|jddk	r+|jd(d)d*�|jdrd|jd<q+d|jd<n|jddekrV|d+|jd7}n|jdrp|d,7}n|jdr�|d-7}nd.}d/}}td|d0td1t��}|jdr|j
r|jd2|�\}}}|d.kr|jd#d3||f�qn|jdrv|j
rv|jd4|�\}}}|d.krv|jd#d5||f�qvn|rc
t}t|�}	t}
|jd6||f�\}}}|d.kr�t|�p�t|�r�|r%tt|�jd7��|d1<d8|d1ko!|d1d8d9k}
d8|d1koE|d1d8dk}|
r�|r�d:|d1kr�|jd#d;||d1d:f�q�q%n�|rw|d<krwd=|krwtt|�jd7��|d1<|jd>�\}}
}d?jd@|dA|
�}|jdBjd%|dC|��\}}}||k}
|jdDjd%|d|��\}}}|jd7�|d1dE<n�ddFdGdHddIdJdKdLdMdNg}|jdO||f�\}}}|j�|kr�t}
nJ|jdP||f�\}}}|d.krt}
n|j|dQt�|
p.|	}|	rR|
rR|jdR|�n|jddk	r.|jdO||f�\}}}|j�dk}||jdkr.t|d0<|jdr�dS}ndT}|j
s+|jdU|||f�\}}}|d.kr(t|||d#dV�q(q+q.n|jddk	r�|jdrWdW}ndX}t|||d#dV�t}|jdO||f�\}}}|d.kr�t}na|d<kr|jddfkr|jdr|	r|j�jdL�rt|�rt}qn||d<||jdkr�t|d0<|j
s�|jdU|||f�\}}}|d.kr�|jd#dY||||f�q�n||d<q�n|jddk	rc
t|||d#dV�|jd|d<dE|d1kr
d}|jddkr)	t|d1�s�	dZ}q�	ns|jdd
krh	t|d1�s\	t|d1�r�	d[}q�	n4t|d1�s�	dZ}n|jdd\ }d|d<|r]
t|d0<|j
s
|jdU|||f�\}}}|d.kr	
|jd#dY|||f�q	
q
q]
q`
t|�s3
tjjd]�d^krC
|jd_�q`
|jd#d`d1|d1�qc
n|j |�dS(gNt
argument_spectnamettypetstrtaliasestservicetunittstatetchoicestreloadedt	restartedtstartedtstoppedtenabledtbooltforcetmaskedt
daemon_reloadtdefaults
daemon-reloadt
daemon_reexecs
daemon-reexectusertscopetsystemtglobaltno_blocktsupports_check_modetrequired_one_oftrequired_bytmutually_exclusivet*t?t[tmsgsZThis module does not currently support using glob patterns, found '%s' in service name: %st	systemctltXDG_RUNTIME_DIRs/run/user/%ss.The 'user' option is being replaced by 'scope'tversions2.11s --%ss --no-blocks --forceittchangedRs%s daemon-reloads#failure %d during daemon-reload: %ss%s daemon-reexecs#failure %d during daemon-reexec: %ss%s show '%s's
t	LoadStates	not-foundt	LoadErrors Error loading unit file '%s': %sisFailed to parse bus messaget@s{unit_base}{sep}t	unit_basetseps,{systemctl} list-unit-files '{unit_search}*'tunit_searchs{systemctl} is-active '{unit}'Rsenabled-runtimetlinkedslinked-runtimesmasked-runtimetstatictindirecttdisabledt	generatedt	transients%s is-enabled '%s's%s list-unit-files '%s'tcheck_rcsPThe service (%s) is actually an init script but the system is managed by systemdtmasktunmasks
%s %s '%s'thosttenabletdisablesUnable to %s service %s: %ststarttstopi����tSYSTEMD_OFFLINEt1syTarget is a chroot or systemd is offline. This can lead to false positives or prevent the init system tools from working.sService is in unknown state(R-(R-(R-(RIRJRK(Nssystem(Nssystem(!RtdicttFalsetTruetparamsRt	fail_jsontget_bin_pathtostgetenvtgeteuidtenviront	deprecatet
check_modetrun_commandR
RR+R
Rt	partitiontformatR R#twarnRR!RRRR	tgett	exit_json(tmoduleR2tglobpatternRMtrcRterrtresulttfoundtis_initdt
is_systemdt	is_maskedRURVtsuffixRWtvalid_enabled_statesR<tactionR9((sB/usr/lib/python2.7/site-packages/ansible/modules/system/systemd.pytmainCs4!	

$





  "%$$+**	"	"	
"

		%"
	"	

	%' 	

	%)$ t__main__(t
__future__RRRR.t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRntansible.module_utils.basicRt(ansible.module_utils.facts.system.chrootR	tansible.module_utils.serviceR
RRtansible.module_utils._textR
RRRR+R�t__name__(((sB/usr/lib/python2.7/site-packages/ansible/modules/system/systemd.pyt<module>s&


N+�				&	�

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