| 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 : |
�
1<�e@ � �h � d dl mZmZmZ eZdZdZdZd dl Z d dl
mZ d dlm
Z
d� Zed k( r e� yy)
� )�absolute_import�division�print_functionas
---
module: getent
short_description: A wrapper to the unix getent utility
description:
- Runs getent against one of its various databases and returns information into
the host's facts, in a C(getent_<database>) prefixed variable.
version_added: "1.8"
options:
database:
description:
- The name of a getent database supported by the target system (passwd, group,
hosts, etc).
type: str
required: True
key:
description:
- Key from which to return values from the specified database, otherwise the
full contents are returned.
type: str
service:
description:
- Override all databases with the specified service
- The underlying system must support the service flag which is not always available.
type: str
version_added: "2.9"
split:
description:
- Character used to split the database values into lists/arrays such as V(:) or V(\\t),
otherwise it will try to pick one depending on the database.
type: str
fail_key:
description:
- If a supplied key is missing this will make the task fail if V(true).
type: bool
default: 'yes'
extends_documentation_fragment:
- action_common_attributes
- action_common_attributes.facts
attributes:
check_mode:
support: full
diff_mode:
support: none
facts:
support: full
platform:
platforms: posix
notes:
- Not all databases support enumeration, check system documentation for details.
author:
- Brian Coca (@bcoca)
aD
- name: Get root user info
ansible.builtin.getent:
database: passwd
key: root
- ansible.builtin.debug:
var: ansible_facts.getent_passwd
- name: Get all groups
ansible.builtin.getent:
database: group
split: ':'
- ansible.builtin.debug:
var: ansible_facts.getent_group
- name: Get all hosts, split by tab
ansible.builtin.getent:
database: hosts
- ansible.builtin.debug:
var: ansible_facts.getent_hosts
- name: Get http service info, no error if missing
ansible.builtin.getent:
database: services
key: http
fail_key: False
- ansible.builtin.debug:
var: ansible_facts.getent_services
- name: Get user password hash (requires sudo/root)
ansible.builtin.getent:
database: shadow
key: www-data
split: ':'
- ansible.builtin.debug:
var: ansible_facts.getent_shadow
a�
ansible_facts:
description: Facts to add to ansible_facts.
returned: always
type: dict
contains:
getent_<database>:
description:
- A list of results or a single result as a list of the fields the db provides
- The list elements depend on the database queried, see getent man page for the structure
- Starting at 2.11 it now returns multiple duplicate entries, previouslly it only returned the last one
returned: always
type: list
N)�
AnsibleModule)� to_nativec �� � t t t dd�� t dd�� t d�� t d�� t dd�� � � d�
� } g d�}| j d }| j j d
� }| j j d� }| j j d� }| j j d� }| j dd� }|�|||g}n||g}|�|j d|g� |�||v rd} | j
|� \ } }
}d}
d|z }|i i} dk( r�i }
j � D ]~ }|j |� }|d |v rN||d dk( r|| |d g|| |d <