community.windows.win_region 模块 – 设置区域和格式设置

注意

此模块是 community.windows 集合 (版本 2.3.0) 的一部分。

如果您使用的是 ansible 软件包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install community.windows

要在 playbook 中使用它,请指定:community.windows.win_region

概要

  • 设置 Windows 服务器的位置设置。

  • 设置 Windows 服务器的格式设置。

  • 设置 Windows 服务器的 Unicode 语言设置。

  • 将这些设置复制到默认配置文件。

参数

参数

注释

copy_settings

布尔值

这会将当前格式和位置值复制到新的用户配置文件和欢迎屏幕。只有在 locationformatunicode_language 导致更改时,此操作才会运行。如果此过程运行,则始终会导致更改。

选项

  • false ← (默认)

  • true

format

字符串

要为当前用户设置的语言格式,请参见 https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx 以获取可使用的文化名称列表。

如果未设置 locationunicode_language,则需要设置此项。

location

字符串

要为当前用户设置的位置,请参见 https://msdn.microsoft.com/en-us/library/dd374073.aspx 以获取可使用的 GeoID 列表及其相关位置。

如果未设置 formatunicode_language,则需要设置此项。

unicode_language

字符串

要为所有用户设置的 Unicode 语言格式,请参见 https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx 以获取可使用的文化名称列表。

如果未设置 locationformat,则需要设置此项。设置此值后,需要重新启动才能生效。

另请参见

另请参见

community.windows.win_timezone

设置 Windows 机器时区。

示例

- name: Set the region format to English United States
  community.windows.win_region:
    format: en-US

- name: Set the region format to English Australia and copy settings to new profiles
  community.windows.win_region:
    format: en-AU
    copy_settings: true

- name: Set the location to United States
  community.windows.win_region:
    location: 244

# Reboot when region settings change
- name: Set the unicode language to English Great Britain, reboot if required
  community.windows.win_region:
    unicode_language: en-GB
  register: result

- ansible.windows.win_reboot:
  when: result.restart_required

# Reboot when format, location or unicode has changed
- name: Set format, location and unicode to English Australia and copy settings, reboot if required
  community.windows.win_region:
    location: 12
    format: en-AU
    unicode_language: en-AU
  register: result

- ansible.windows.win_reboot:
  when: result.restart_required

返回值

常见的返回值已在此处记录,以下是此模块独有的字段

描述

restart_required

布尔值

更改是否需要重新启动才能生效。

返回:成功

示例:true

作者

  • Jordan Borean (@jborean93)