403Webshell
Server IP : 157.22.201.140  /  Your IP : 216.73.216.74
Web Server : nginx/1.30.1
System : Linux mit.vincode.fvds.ru 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/ansible/modules/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/ansible/modules/__pycache__/systemd_service.cpython-312.pyc
�

1<�e�^���ddlmZmZmZeZdZdZdZddl	Z	ddl
mZddlm
Z
ddlmZmZmZdd	lmZd
�Zd�Zd�Zd
�Zd�Zedk(re�yy)�)�absolute_import�division�print_functiona�
module: systemd_service
author:
    - Ansible Core Team
version_added: "2.2"
short_description:  Manage systemd units
description:
    - Controls systemd units (services, timers, and so on) on remote hosts.
options:
    name:
        description:
            - Name of the unit. This parameter takes the name of exactly one unit to work with.
            - When no extension is given, it is implied to a C(.service) as systemd.
            - When using in a chroot environment you always need to specify the name of the unit with the extension. For example, C(crond.service).
        type: str
        aliases: [ service, unit ]
    state:
        description:
            - V(started)/V(stopped) are idempotent actions that will not run commands unless necessary.
              V(restarted) will always bounce the unit.
              V(reloaded) will always reload and if the service is not running at the moment of the reload, it is started.
        type: str
        choices: [ reloaded, restarted, started, stopped ]
    enabled:
        description:
            - Whether the unit 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 V(true), 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"
    scope:
        description:
            - Run systemctl within a given service manager scope, either as the default system scope V(system),
              the current user's scope V(user), or the scope of all users V(global).
            - "For systemd to work with 'user', the executing user must have its own instance of dbus started and accessible (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."
            - The user must have access, normally given via setting the C(XDG_RUNTIME_DIR) variable, see example below.

        type: str
        choices: [ system, user, global ]
        default: system
        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"
extends_documentation_fragment: action_common_attributes
attributes:
    check_mode:
        support: full
    diff_mode:
        support: none
    platform:
        platforms: posix
notes:
    - Since 2.4, one of the following options is required O(state), O(enabled), O(masked), O(daemon_reload), (O(daemon_reexec) since 2.8),
      and all except O(daemon_reload) and (O(daemon_reexec) since 2.8) also require O(name).
    - Before 2.4 you always required O(name).
    - Globs are not supported in name, i.e C(postgres*.service).
    - The service names might vary by specific OS/distribution
    - The order of execution when having multiple properties is to first enable/disable, then mask/unmask and then deal with service state.
      It has been reported that systemctl can behave differently depending on the order of operations if you do the same manually.
requirements:
    - A system managed by systemd.
a(
- name: Make sure a service unit is running
  ansible.builtin.systemd_service:
    state: started
    name: httpd

- name: Stop service cron on debian, if running
  ansible.builtin.systemd_service:
    name: cron
    state: stopped

- name: Restart service cron on centos, in all cases, also issue daemon-reload to pick up config changes
  ansible.builtin.systemd_service:
    state: restarted
    daemon_reload: true
    name: crond

- name: Reload service httpd, in all cases
  ansible.builtin.systemd_service:
    name: httpd.service
    state: reloaded

- name: Enable service httpd and ensure it is not masked
  ansible.builtin.systemd_service:
    name: httpd
    enabled: true
    masked: no

- name: Enable a timer unit for dnf-automatic
  ansible.builtin.systemd_service:
    name: dnf-automatic.timer
    state: started
    enabled: true

- name: Just force systemd to reread configs (2.4 and above)
  ansible.builtin.systemd_service:
    daemon_reload: true

- name: Just force systemd to re-execute itself (2.8 and above)
  ansible.builtin.systemd_service:
    daemon_reexec: true

- name: Run a user service when XDG_RUNTIME_DIR is not set on remote login
  ansible.builtin.systemd_service:
    name: myservice
    state: started
    scope: user
  environment:
    XDG_RUNTIME_DIR: "/run/user/{{ myuid }}"
aB
status:
    description: A dictionary with the key=value pairs returned from C(systemctl show).
    returned: success
    type: dict
    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)�
AnsibleModule)�	is_chroot)�sysv_exists�sysv_is_enabled�fail_if_missing)�	to_nativec�&�|dtddg�vS)N�ActiveState�active�
activating��set��service_statuss �A/usr/lib/python3/dist-packages/ansible/modules/systemd_service.py�is_running_servicer!s���-�(�C��<�0H�,I�I�I�c�$�|dtdg�vS)Nr
�deactivatingrrs r�is_deactivating_servicer%s���-�(�C��0@�,A�A�Arc�"�d|vxr
d|vxsd|vS)N�=zignoring requestzignoring command�)�outs r�request_was_ignoredr)s#���c�>�V�1�S�8�U�<N�RU�<U�Vrc���i}g}d}|D]�}|��d|vs�
|jdd�\}}|jd�rP|j�jd�r1|j�j	d�s|j|���|j
�||<d}��|j|�|j�j	d�s��dj|�j
�||<g}d}��|S)Nr��Exec�{�}�
)�split�
startswith�lstrip�rstrip�endswith�append�strip�join)�lines�parsed�multival�k�line�vs      r�parse_systemctl_showr3-s����F��H��A�����9��d�{��z�z�#�q�)���1��<�<��'�A�H�H�J�,A�,A�#�,F��8�8�:�.�.�s�3� ����*� ��G�G�I��q�	����O�O�D�!��{�{�}�%�%�c�*� �I�I�h�/�5�5�7��q�	������ �Mrc��tttdddg��tdgd���td��td��td��tdd	d
g��tdd	dg��tdd
gd���tdd	����	dgd�gtddd����}|jd}|�$dD]}||vs�|jd|�d|�����!|j	dd�}tjd��(dtj�zt
jd<|jdd
k7r|d |jdzz
}|jd!r|d"z
}|jd#r|d$z
}d%}d&x}}t|d	t��'�}|jd(r�|jsx|jd)|z�\}}}|d%k7r[t|�s"t
jjd*�d+k(r|jd,||fz�n|jd-||fz��|jd.r�|jsx|jd/|z�\}}}|d%k7r[t|�s"t
jjd*�d+k(r|jd0||fz�n|jd1||fz��|�rFd	}t|�}	d	}
|j|�d2|�d3��\}}}|d%k(r�t|�s�t|�s|�r�t!t#|�j%d4��|d5<d6|d5vxr|d5d6d7k7}
d6|d5vxr|d5d6d8k(}|
�rV|�sSd9|d5v�rK|jd:|�d;|d5d9�����n+|r�|d<k(r�d=|vr�t!t#|�j%d4��|d5<|j'd>�\}}
}d?j)||
�@�}|jdAj)||�B��\}}}||v}
|jdCj)||�D��\}}}|j+d4�|d5dE<njgdF�}|j|�dG|�d3��\}}}|j-�|vrd}
n6|j|�dH|�d3��\}}}|d%k(rd}
n|j|d�I�|
xs|	}|	r|
s|jdJ|z�|jd8��|j|�dG|�d3��\}}}|j-�d8k(}||jd8k7rWd|dK<|jd8rdL}ndM}|js2|j|�dN|�dO|�d3��\}}}|d%k7rt/|||dP��|jdQ��&|jdQrdR}ndS}t/|||dP��d	}|j|�dG|�dT��\}}}|d%k(r-d}|j1�dUgk(s|j1�dVgk(rHd	}nE|d<k(r@|jdd
k(r.|	r,|j-�j3dW�s
t5|�rd}||dQ<||jdQk7rXd|dK<|jsA|j|�dN|�dO|�d3��\}}}|d%k7r|jdX|�dY|�dZ||z����||dQ<|jd[��Mt/|||dP��|jd[|d[<dE|d5vr�d}|jd[d\k(rt7|d5�s\d]}nY|jd[d^k(rt7|d5�st9|d5�r+d_}n(t7|d5�sd]}n|jd[dd`}d\|d[<|r�d|dK<|js�|j|�dN|�dO|�d3��\}}}|d%k7rq|jdX|�dY|�dZ|����nUt|�s"t
jjd*�d+k(r|jda�n|jdb|d5�c�|j:ddi|��y)eN�str�service�unit)�type�aliases)�reloaded�	restarted�started�stopped)r8�choices�bool)r8Fz
daemon-reload)r8�defaultr9z
daemon-reexec�system)rA�user�global)r8r@r>)r8r@)	�name�state�enabled�force�masked�
daemon_reload�
daemon_reexec�scope�no_blockT)rErFrHrIrJ)rD)rErFrH)�
argument_spec�supports_check_mode�required_one_of�required_byrD)�*�?�[zCThis module does not currently support using glob patterns, found 'z' in service name: )�msg�	systemctl�XDG_RUNTIME_DIRz/run/user/%srKz --%srLz --no-blockrGz --forcer�)rD�changed�statusrIz%s daemon-reload�SYSTEMD_OFFLINE�1zbdaemon-reload failed, but target is a chroot or systemd is offline. Continuing. Error was: %d / %sz#failure %d during daemon-reload: %srJz%s daemon-reexeczbdaemon-reexec failed, but target is a chroot or systemd is offline. Continuing. Error was: %d / %sz#failure %d during daemon-reexec: %sz show '�'r$rY�	LoadStatez	not-foundrH�	LoadErrorzError loading unit file 'z': r zFailed to parse bus message�@z{unit_base}{sep})�	unit_base�sepz,{systemctl} list-unit-files '{unit_search}*')rU�unit_searchz{systemctl} is-active '{unit}')rUr7r
)rFzenabled-runtime�linkedzlinked-runtimerHzmasked-runtime�static�indirect�disabled�	generated�	transientz
 is-enabled 'z list-unit-files ')�check_rczPThe service (%s) is actually an init script but the system is managed by systemdrX�mask�unmask� z '�hostrF�enable�disablez' -lre�aliasrfz
Unable to z	 service z: rEr<�startr=�stop���zyTarget is a chroot or systemd is offline. This can lead to false positives or prevent the init system tools from working.zService is in unknown state)rTrYr)r�dict�params�	fail_json�get_bin_path�os�getenv�geteuid�environ�
check_mode�run_commandr�get�warnrrr3rr%�	partition�formatr(r+r
�
splitlinesr)r	rr�	exit_json)�moduler7�globpatternrU�rcr�err�result�found�is_initd�
is_systemd�	is_maskedr`ra�suffixrb�valid_enabled_statesrH�actionrFs                    r�mainr�Ss���
���5�9�f�*=�>��E�+Z�[��f�%��F�#��V�$��F�E�O�CT�U��F�E�O�CT�U��E�8�=Y�Z��v�u�5�

�!�Y�Z�����
��F�*�=�=�� �D���-�	Y�K��d�"�� � �FQ�SW�&X� �Y�	Y��#�#�K��6�I�	�y�y�"�#�+�(6�����(E��
�
�$�%�
�}�}�W���)��W�v�}�}�W�5�5�5�	�
�}�}�Z� ��]�"�	�
�}�}�W���Z��	�	
�B��N�C�#�
�
���v��F��}�}�_�%�f�.?�.?��+�+�,>�)�,L�M���S�#�
��7��� �B�J�J�N�N�3D�$E��$L����A�EG�IL�DM�M�N�� � �%J�b�RU�Y�%V� �W��}�}�_�%�f�.?�.?��+�+�,>�)�,L�M���S�#�
��7��� �B�J�J�N�N�3D�$E��$L����A�EG�IL�DM�M�N�� � �%J�b�RU�Y�%V� �W�����t�$���
� �+�+�i��,N�O���S�#�
��7�/��4�8K�C�8P��#7�	�#��8L�8L�T�8R�#S��x� �(�F�8�,<�<�m���AQ�R]�A^�bm�Am�
�'�6�(�+;�;�i��x�@P�Q\�@]�ai�@i�	��i�K�6�(�CS�4S��$�$�t�U[�\d�Ue�fq�Ur�)s�$�t��R�1�W�!>�#�!E�3�I�c�N�4H�4H��4N�O�F�8��%)�^�^�C�%8�"�I�s�F�,�3�3�i�S�3�Q�K�#�/�/�0^�0e�0e�py�HS�0e�1T�U�N�R��c�$��+�J�#�/�/�0P�0W�0W�bk�rv�0W�0w�x�N�R��c�.1�j�j��.>�F�8��]�+�$� �$�/�/�	�SW�0X�Y�N�R��c��y�y�{�2�2�!�
�"(�!3�!3�QZ�\`�4a�!b���S�#���7�!%�J��&�&�y�4�&�@��&�h���J��K�K�j�mq�q�r��=�=��"�.�#�/�/�	�SW�0X�Y�N�R��c��Y�Y�[�H�,�F�����x�0�0�$(��y�!��=�=��*�#�F�%�F��(�(�%+�%7�%7�	�SY�[_�8`�%a�N�R��c��Q�w�'���t��H��=�=��#�/��}�}�Y�'�!��"���F�E�4�V�<��G�#�/�/�9�VZ�0[�\�N�R��c��Q�w����>�>�#�
�|�3�s�~�~�7G�G�9�7T�#�G��q���=�=��)�X�5� ��I�I�K�0�0��<�'��-�"�G�!(�F�9���&�-�-�	�2�2�$(��y�!��(�(�%+�%7�%7�	�SY�[_�8`�%a�N�R��c��Q�w��(�(�f�VZ�\_�be�\e�-f�(�g�(/�K��y�!��=�=��!�-��F�E�4�V�<�%�m�m�G�4�F�7�O���x� 0�0����=�=��)�Y�6�-�f�X�.>�?�!(���]�]�7�+�y�8�)�&��*:�;�?V�W]�^f�Wg�?h�!'��-�f�X�.>�?�!(��!'���w�!7���!<��&/�F�7�O��(,�F�9�%�!�,�,�)/�);�);�I�W]�_c�<d�)e���S�#���7�"�,�,�RX�Z^�`c�1d�,�e��6�"�b�j�j�n�n�5F�&G�3�&N����X�Y�� � �%B�6�RZ�K[� �\��F����v�r�__main__)�
__future__rrrr8�
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNrx�ansible.module_utils.basicr�(ansible.module_utils.facts.system.chrootr�ansible.module_utils.servicerr	r
�+ansible.module_utils.common.text.convertersrrrrr3r��__name__rrr�<module>r�st��A�@��
�X�
�t1��f@
��D
�4�>�V�V�A�J�B�W� �Lk�\�z���F�r

Youez - 2016 - github.com/yon3zu
LinuXploit