community.windows.win_domain_object_info 模块 – 收集 Active Directory 对象的信息
注意
此模块是 community.windows 集合(版本 2.3.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.windows
。
要在 playbook 中使用它,请指定: community.windows.win_domain_object_info
。
已弃用
- 在以下版本中删除:
版本 3.0.0
- 原因:
此模块已移至
microsoft.ad
集合中。- 替代方案:
请改用 microsoft.ad.object_info 模块。
概要
收集有关多个 Active Directory 对象的信息。
参数
参数 |
注释 |
---|---|
|
|
指定要连接的 Active Directory 域服务实例。 可以是 FQDN 或 NetBIOS 名称的形式。 如果未指定,则该值基于运行 PowerShell 的计算机的默认域。 |
|
与 AD 交互时要使用的用户名。 如果未设置此项,则用于身份验证的用户将是连接用户。 除非身份验证是 Kerberos 并且具有凭据委派或 CredSSP,否则 Ansible 将无法使用连接用户,或者在任务中使用 become。 |
|
使用 PowerShell 表达式语言语法指定查询字符串。 这遵循与 PowerShell AD cmdlet 的 这与 _identity_ 和 _ldap_filter_ 互斥。 |
|
通过其专有名称或对象 GUID 指定单个 Active Directory 对象。 这与 _filter_ 和 _ldap_filter_ 互斥。 不能与 _search_base_ 或 _search_scope_ 选项一起使用。 |
|
同时搜索已删除的 Active Directory 对象。 选项
|
|
与 _filter_ 类似,但这是一个传统的 LDAP 查询字符串,用于筛选要返回的对象。 这与 _filter_ 和 _identity_ 互斥。 |
|
要返回的属性列表。 如果属性是 如果属性在对象上有效但未设置,则仅当在此选项列表中显式定义时才会返回。 始终返回 指定多个属性可能会对性能产生影响,最好只返回所需的属性。 如果指定了无效属性,则模块将针对其无效的每个对象显示警告。 |
|
指定要搜索对象的 Active Directory 路径。 不能与 _identity_ 一起设置。 默认情况下,搜索库是目标 AD 实例的默认命名上下文,即 “(Get-ADRootDSE).defaultNamingContext” 返回的 DN。 |
|
指定在
不能与 _identity_ 一起设置。 选项
|
注释
注意
sAMAccountType_AnsibleFlags
和userAccountControl_AnsibleFlags
返回属性是模块本身设置的,目的是作为一种查看这些标志所代表内容的简便方法。这些属性不能用作 _filter_ 或 _ldap_filter_ 的一部分,并且如果在请求这些属性时会自动添加。必须在安装了 ActiveDirectory powershell 模块的主机上运行此命令。
示例
- name: Get all properties for the specified account using its DistinguishedName
community.windows.win_domain_object_info:
identity: CN=Username,CN=Users,DC=domain,DC=com
properties: '*'
- name: Get the SID for all user accounts as a filter
community.windows.win_domain_object_info:
filter: ObjectClass -eq 'user' -and objectCategory -eq 'Person'
properties:
- objectSid
- name: Get the SID for all user accounts as a LDAP filter
community.windows.win_domain_object_info:
ldap_filter: (&(objectClass=user)(objectCategory=Person))
properties:
- objectSid
- name: Search all computer accounts in a specific path that were added after February 1st
community.windows.win_domain_object_info:
filter: objectClass -eq 'computer' -and whenCreated -gt '20200201000000.0Z'
properties: '*'
search_scope: one_level
search_base: CN=Computers,DC=domain,DC=com
返回值
常见返回值在此处记录 此处,以下是此模块特有的字段
键 |
描述 |
---|---|
找到的 Active Directory 对象以及所请求的属性的字典列表。 字典的键是属性名称,值是属性的值。 所有日期属性均以 UTC 时区的 ISO 8601 格式返回。 所有 SID 属性都作为字典返回,其中键 所有字节属性都作为 base64 字符串返回。 所有安全描述符属性都作为该描述符的 SDDL 字符串返回。 始终返回 返回: 始终 示例: |
状态
此模块将在 3.0.0 版本中移除。[已弃用]
有关更多信息,请参阅 已弃用。