community.windows.win_domain_group 模块 – 创建、修改或删除域组
注意
此模块是 community.windows 集合(版本 2.3.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了这个集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.windows
。
要在 playbook 中使用它,请指定:community.windows.win_domain_group
。
已弃用
- 在:中删除
版本 3.0.0
- 原因:
此模块已移至
microsoft.ad
集合中。- 替代方案:
请改用 microsoft.ad.group 模块。
概要
在 Active Directory 中创建、修改或删除组。
对于本地组,请改用 ansible.windows.win_group 模块。
参数
参数 |
注释 |
---|---|
要在组上设置的自定义 LDAP 属性字典。 这可以用于设置未作为模块参数公开的自定义属性,例如 请参阅示例,了解如何格式化此参数。 |
|
组的类别,这是分配给 LDAP 如果创建新组,则默认情况下将使用 选择
|
|
要分配给 LDAP |
|
要分配给 LDAP |
|
|
|
指定要连接的 Active Directory 域服务实例。 可以是 FQDN 或 NetBIOS 名称的形式。 如果未指定,则该值基于运行 PowerShell 的计算机的域。 |
|
与 AD 交互时要使用的用户名。 如果未设置,则将改用 Ansible 用于登录的用户名。 |
|
在删除或移动组时,将忽略 如果需要执行其中一个操作并且此值设置为 选择
|
|
要分配给 LDAP 此值可以是 |
|
要创建、修改或删除的组的名称。 此值可以是 |
|
创建组或将组移动到的完整 LDAP 路径。 这应该是要创建组或将组移动到的父对象的路径。 有关此路径如何形成的详细信息,请参阅示例。 |
|
将根据此值设置 此标志阻止用户删除组或将其移动到其他路径。 选择
|
|
组的范围。 如果 选择
|
|
如果 如果 选择
|
注释
注意
必须在安装了 ActiveDirectory powershell 模块的主机上运行此操作。
另请参阅
另请参阅
- ansible.windows.win_domain
确保 Windows 域的存在。
- ansible.windows.win_domain_controller
管理 Windows 主机的域控制器/成员服务器状态。
- community.windows.win_domain_computer
管理 Active Directory 中的计算机。
- ansible.windows.win_domain_membership
管理 Windows 主机的域/工作组成员身份。
- community.windows.win_domain_user
管理 Windows Active Directory 用户帐户。
- ansible.windows.win_group
添加和删除本地组。
- ansible.windows.win_group_membership
管理 Windows 本地组成员身份。
示例
- name: Ensure the group Cow exists using sAMAccountName
community.windows.win_domain_group:
name: Cow
scope: global
path: OU=groups,DC=ansible,DC=local
- name: Ensure the group Cow doesn't exist using the Distinguished Name
community.windows.win_domain_group:
name: CN=Cow,OU=groups,DC=ansible,DC=local
state: absent
- name: Delete group ignoring the protection flag
community.windows.win_domain_group:
name: Cow
state: absent
ignore_protection: true
- name: Create group with delete protection enabled and custom attributes
community.windows.win_domain_group:
name: Ansible Users
scope: domainlocal
category: security
attributes:
mail: [email protected]
wWWHomePage: www.ansible.com
ignore_protection: true
- name: Change the OU of a group using the SID and ignore the protection flag
community.windows.win_domain_group:
name: S-1-5-21-2171456218-3732823212-122182344-1189
scope: global
organizational_unit: OU=groups,DC=ansible,DC=local
ignore_protection: true
- name: Add managed_by user
community.windows.win_domain_group:
name: Group Name Here
managed_by: Domain Admins
- name: Add group and specify the AD domain services to use for the create
community.windows.win_domain_group:
name: Test Group
domain_username: [email protected]
domain_password: Password01!
domain_server: corp-DC12.corp.ansible.com
scope: domainlocal
返回值
此处记录了常见的返回值 此处,以下是此模块独有的字段
键 |
描述 |
---|---|
模块设置的自定义属性。这不会显示所有自定义属性,而仅显示由模块设置的属性。 返回: 组存在,并且在模块调用时设置了属性 示例: |
|
组的规范名称。 返回: 组存在 示例: |
|
组的组类型值,即安全组或通讯组。 返回: 组存在 示例: |
|
是否创建了组 返回: 总是返回 示例: |
|
组的描述。 返回: 组存在 示例: |
|
组的显示名称。 返回: 组存在 示例: |
|
组的完整可分辨名称。 返回: 组存在 示例: |
|
组的组范围值。 返回: 组存在 示例: |
|
组的 GUID。 返回: 组存在 示例: |
|
在 managedBy 属性上设置的 AD 对象的完整可分辨名称。 返回: 组存在 示例: |
|
组的名称。 返回: 组存在 示例: |
|
组是否受保护以免意外删除。 返回: 组存在 示例: |
|
组的安全 ID。 返回: 组存在 示例: |
状态
此模块将在 3.0.0 版本中移除。[已弃用]
有关更多信息,请参阅 已弃用。