community.windows.win_user_profile 模块 – 管理 Windows 用户配置文件。
注意
此模块是 community.windows 集合(版本 2.3.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了这个集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.windows
。
要在 playbook 中使用它,请指定:community.windows.win_user_profile
。
概要
用于在 Windows 主机上创建或删除用户配置文件。
这可用于在用户登录之前创建配置文件,或在删除用户帐户时删除配置文件。
可以为本地或域帐户创建配置文件。
参数
参数 |
注释 |
---|---|
指定配置文件路径的基本名称。 当 state 为 这不能用于指定配置文件目录之外的路径,而是指定此目录中的文件夹。 如果同一路径下已存在其他用户的配置文件,Windows 将自动附加一个 3 位数的增量数字。 当 state 为 如果帐户不再存在但配置文件仍然存在,这将非常有用。 |
|
当 state 为 将此值设置为 选择
|
|
当设置为 创建配置文件时,必须将 username 选项设置为有效帐户。 当设置为 删除配置文件时,必须将 username 设置为有效帐户,或者将 name 设置为配置文件的基本名称。 选择
|
|
配置文件的安全标识符 (SID) 的帐户名称。 当 state 为 当 state 为 |
另请参阅
另请参阅
- ansible.windows.win_user
管理本地 Windows 用户帐户。
- community.windows.win_domain_user
管理 Windows Active Directory 用户帐户。
示例
- name: Create a profile for an account
community.windows.win_user_profile:
username: ansible-account
state: present
- name: Create a profile for an account at C:\Users\ansible
community.windows.win_user_profile:
username: ansible-account
name: ansible
state: present
- name: Remove a profile for a still valid account
community.windows.win_user_profile:
username: ansible-account
state: absent
- name: Remove a profile for a deleted account
community.windows.win_user_profile:
name: ansible
state: absent
- name: Remove a profile for a deleted account based on the SID
community.windows.win_user_profile:
username: S-1-5-21-3233007181-2234767541-1895602582-1305
state: absent
- name: Remove multiple profiles that exist at the basename path
community.windows.win_user_profile:
name: ansible
state: absent
remove_multiple: true
返回值
常见的返回值记录在 此处,以下是此模块独有的字段
键 |
描述 |
---|---|
帐户配置文件的完整路径。如果 返回: 始终 示例: |