403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.11/site-packages/ansible/modules/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.11/site-packages/ansible/modules/__pycache__/systemd_service.cpython-311.pyc
�

���cK[���ddlmZmZmZeZdZdZdZddl	Z	ddl
mZddlm
Z
ddlmZmZmZdd	lmZd
�Zd�Zd�Zd
�Zd�Zedkre��dSdS)�)�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:
            - C(started)/C(stopped) are idempotent actions that will not run commands unless necessary.
              C(restarted) will always bounce the unit. C(reloaded) will always reload.
        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 C(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 C(system),
              the current user's scope C(user), or the scope of all users C(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 C(state), C(enabled), C(masked), C(daemon_reload), (C(daemon_reexec) since 2.8),
      and all except C(daemon_reload) and (C(daemon_reexec) since 2.8) also require C(name).
    - Before 2.4 you always required C(name).
    - Globs are not supported in name, i.e C(postgres*.service).
    - The service names might vary by specific OS/distribution
requirements:
    - A system managed by systemd.
a�
- name: Make sure a service unit is running
  ansible.builtin.systemd:
    state: started
    name: httpd

- name: Stop service cron on debian, if running
  ansible.builtin.systemd:
    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:
    state: restarted
    daemon_reload: true
    name: crond

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

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

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

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

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

- name: Run a user service when XDG_RUNTIME_DIR is not set on remote login
  ansible.builtin.systemd:
    name: myservice
    state: started
    scope: user
  environment:
    XDG_RUNTIME_DIR: "/run/user/{{ myuid }}"
aE
status:
    description: A dictionary with the key=value pairs returned from C(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)�
AnsibleModule)�	is_chroot)�sysv_exists�sysv_is_enabled�fail_if_missing)�	to_nativec�4�|dtddg��vS)N�ActiveState�active�
activating��set��service_statuss �D/usr/lib/python3.11/site-packages/ansible/modules/systemd_service.py�is_running_servicers���-�(�C��<�0H�,I�,I�I�I�c�2�|dtdg��vS)Nr
�deactivatingrrs r�is_deactivating_servicer"s���-�(�C��0@�,A�,A�A�Arc��d|vod|vpd|vS)N�=zignoring requestzignoring command�)�outs r�request_was_ignoredr&s#���c�>�V�1�S�8�U�<N�RU�<U�Vrc�X�i}g}d}|D�]}|��d|vr�|�dd��\}}|�d��rd|����d��r=|����d��s|�|����|���||<d}��|�|��|����d��r.d�|�����||<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�J�,A�,A�#�,F�,F�!��8�8�:�:�.�.�s�3�3�!� ����*�*�*� ��G�G�I�I��q�	�����O�O�D�!�!�!��{�{�}�}�%�%�c�*�*�
� �I�I�h�/�/�5�5�7�7��q�	�������Mrc��tttdddg���tdgd����td���td���td���tdd	d
g���tdd	dg���tdd
gd����tdd	�����	�	dgd�gtddd������}|jd}|�%dD]"}||vr|�d|�d|������#|�dd��}tjd���#dtj��zt
jd<	|jdd
kr|d |jdzz
}|jd!r|d"z
}|jd#r|d$z
}d%}d&x}}t|d	t���'��}|jd(rD|j	s=|�
d)|z��\}}}|d%kr|�d*||fz���|jd+rD|j	s=|�
d,|z��\}}}|d%kr|�d-||fz���|�rd	}t|��}	d	}
|�
|�d.|�d/���\}}}|d%kr�t|��s�t|��s�|r�tt|���d0����|d1<d2|d1vo|d1d2d3k}
d2|d1vo|d1d2d4k}|
r4|s2d5|d1vr(|�d6|�d7|d1d5������nh|r�|d8kr�d9|vr�tt|���d0����|d1<|�d:��\}}
}d;�||
�<��}|�
d=�||�>����\}}}||v}
|�
d?�||�@����\}}}|�d0��|d1dA<n{gdB�}|�
|�dC|�d/���\}}}|���|vrd}
n?|�
|�dD|�d/���\}}}|d%krd}
n|�
|d�E��|
p|	}|	r|
s|�dF|z��|jd4��|�
|�dC|�d/���\}}}|���d4k}||jd4krYd|dG<|jd4rdH}ndI}|j	s;|�
|�dJ|�dK|�d/���\}}}|d%krt+|||dL���|jdM��F|jdMrdN}ndO}t+|||dL���d	}|�
|�dC|�dP���\}}}|d%kr7d}|���dQgks|���dRgkrd	}nQ|d8krK|jdd
kr:|	r8|����dS��st1|��rd}||dM<||jdMkr\d|dG<|j	sJ|�
|�dJ|�dK|�d/���\}}}|d%kr"|�dT|�dU|�dV||z�����||dM<|jdW���t+|||dL���|jdW|dW<dA|d1vr�d}|jdWdXkrt3|d1��sdY}np|jdWdZkr-t3|d1��st5|d1��rd[}n2t3|d1��sdY}n|jdWdd\�}dX|dW<|rSd|dG<|j	sG|�
|�dJ|�dK|�d/���\}}}|d%kr|�dT|�dU|�dV|�����net7|��s#t
j�d]��d^kr|�d_��n|�d`|d1�a��|jdbi|��dS)cN�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-reloadz#failure %d during daemon-reload: %srJz%s daemon-reexecz#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' -lrc�aliasrdz
Unable to z	 service z: rEr<�startr=�stop����SYSTEMD_OFFLINE�1zyTarget 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_commandrrr3rr%�	partition�formatr(r+�warnr
�
splitlinesr)r	rrr�get�	exit_json)�moduler7�globpatternrU�rcr�err�result�found�is_initd�
is_systemd�	is_maskedr^r_�suffixr`�valid_enabled_statesrH�actionrFs                    r�mainr�Ps�
��
���5�9�f�*=�>�>�>��E�+Z�+Z�+Z�[�[�[��f�%�%�%��F�#�#�#��V�$�$�$��F�E�O�CT�U�U�U��F�E�O�CT�U�U�U��E�8�=Y�=Y�=Y�Z�Z�Z��v�u�5�5�5�

�

�

�!�Y�Y�Y�Z�����
�
�
����F�*�=�� �D���-�	Y�	Y�K��d�"�"�� � � �FQ�FQ�FQ�SW�SW�&X� �Y�Y�Y���#�#�K��6�6�I�	�y�"�#�#�+�(6�����(E��
�$�%�/��}�W���)�)��W�v�}�W�5�5�5�	�
�}�Z� �#��]�"�	�
�}�W�� ��Z��	�	
�B��N�C�#�
�
���v�v����F��}�_�%�T�f�.?�T��+�+�,>�)�,L�M�M���S�#�
��7�7����!F�"�c��!R��S�S�S��}�_�%�T�f�.?�T��+�+�,>�)�,L�M�M���S�#�
��7�7����!F�"�c��!R��S�S�S��a]����t�$�$���
� �+�+�i�i�i����,N�O�O���S�#�
��7�7�/��4�4�7�8K�C�8P�8P�7��	
u�#7�	�#���8L�8L�T�8R�8R�#S�#S��x� �(�F�8�,<�<�m���AQ�R]�A^�bm�Am�
�'�6�(�+;�;�i��x�@P�Q\�@]�ai�@i�	��u�i�u�K�6�(�CS�4S�4S��$�$�$�t�t�t�U[�\d�Ue�fq�Ur�Ur�)s�$�t�t�t���%	A�R�1�W�W�!>�#�!E�!E�3�I�c�N�N�4H�4H��4N�4N�O�O�F�8��%)�^�^�C�%8�%8�"�I�s�F�,�3�3�i�S�3�Q�Q�K�#�/�/�0^�0e�0e�py�HS�0e�1T�1T�U�U�N�R��c�$��+�J�#�/�/�0P�0W�0W�bk�rv�0W�0w�0w�x�x�N�R��c�.1�j�j��.>�.>�F�8��]�+�+�$�$�$� �$�/�/�	�	�	�SW�SW�SW�0X�Y�Y�N�R��c��y�y�{�{�2�2�2�!�
�
�"(�!3�!3�QZ�QZ�QZ�\`�\`�\`�4a�!b�!b���S�#���7�7�!%�J�J��&�&�y�4�&�@�@�@��&�h���	s�J�	s��K�K�j�mq�q�r�r�r��=��"�.�#�/�/�	�	�	�SW�SW�SW�0X�Y�Y�N�R��c��Y�Y�[�[�H�,�F����x�0�0�0�$(��y�!��=��*�&�#�F�F�%�F��(�I�%+�%7�%7�	�	�	�SY�SY�SY�[_�[_�[_�8`�%a�%a�N�R��c��Q�w�w�'���t��H�H�H�H��=��#�/��}�Y�'�
#�!���"���F�E�4�V�<�<�<�<��G�#�/�/�9�9�9�VZ�VZ�VZ�0[�\�\�N�R��c��Q�w�w����>�>�#�#�
�|�3�3�s�~�~�7G�7G�G�9�7T�7T�#�G���q����=��)�X�5�5� �6��I�I�K�K�0�0��<�<�6�(��-�-�6�#�G�!(�F�9���&�-�	�2�2�2�$(��y�!��(�h�%+�%7�%7�	�	�	�SY�SY�SY�[_�[_�[_�8`�%a�%a�N�R��c��Q�w�w��(�(�(�f�f�f�VZ�VZ�VZ�\_�be�\e�\e�-f�(�g�g�g�(/�K��y�!��=��!�-��F�E�4�V�<�<�<�<�%�m�G�4�F�7�O���x� 0�0�0����=��)�Y�6�6�-�f�X�.>�?�?�)�!(����]�7�+�y�8�8�)�&��*:�;�;�(�?V�W]�^f�Wg�?h�?h�(�!'���-�f�X�.>�?�?�=�!(���!'��w�!7����!<��&/�F�7�O��f�(,�F�9�%�!�,�f�)/�);�);�I�I�I�W]�W]�W]�_c�_c�_c�<d�)e�)e���S�#���7�7�"�,�,�,�RX�RX�RX�Z^�Z^�Z^�`c�`c�1d�,�e�e�e���6�"�"�
]�b�j�n�n�5F�&G�&G�3�&N�&N����X�Y�Y�Y�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._textrrrrr3r��__name__rrr�<module>r�s!��A�@�@�@�@�@�@�@�@�@��
�U�
�n1��f@
��D
�	�	�	�4�4�4�4�4�4�>�>�>�>�>�>�V�V�V�V�V�V�V�V�V�V�0�0�0�0�0�0�J�J�J�B�B�B�W�W�W� � � �Le�e�e�P�z����D�F�F�F�F�F��r

Youez - 2016 - github.com/yon3zu
LinuXploit