1#!/usr/local/bin/python3.8
2# -*- coding: utf-8 -*-
3
4# Copyright: (c) 2016, Ansible, inc
5# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7DOCUMENTATION = r'''
8module: win_region
9short_description: Set the region and format settings
10description:
11    - Set the location settings of a Windows Server.
12    - Set the format settings of a Windows Server.
13    - Set the unicode language settings of a Windows Server.
14    - Copy across these settings to the default profile.
15options:
16    location:
17        description:
18            - The location to set for the current user, see
19              U(https://msdn.microsoft.com/en-us/library/dd374073.aspx)
20              for a list of GeoIDs you can use and what location it relates to.
21            - This needs to be set if C(format) or C(unicode_language) is not
22              set.
23        type: str
24    format:
25        description:
26            - The language format to set for the current user, see
27              U(https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx)
28              for a list of culture names to use.
29            - This needs to be set if C(location) or C(unicode_language) is not set.
30        type: str
31    unicode_language:
32        description:
33            - The unicode language format to set for all users, see
34              U(https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx)
35              for a list of culture names to use.
36            - This needs to be set if C(location) or C(format) is not set. After setting this
37              value a reboot is required for it to take effect.
38        type: str
39    copy_settings:
40        description:
41            - This will copy the current format and location values to new user
42              profiles and the welcome screen. This will only run if
43              C(location), C(format) or C(unicode_language) has resulted in a
44              change. If this process runs then it will always result in a
45              change.
46        type: bool
47        default: no
48seealso:
49- module: community.windows.win_timezone
50author:
51- Jordan Borean (@jborean93)
52'''
53
54EXAMPLES = r'''
55- name: Set the region format to English United States
56  community.windows.win_region:
57    format: en-US
58
59- name: Set the region format to English Australia and copy settings to new profiles
60  community.windows.win_region:
61    format: en-AU
62    copy_settings: yes
63
64- name: Set the location to United States
65  community.windows.win_region:
66    location: 244
67
68# Reboot when region settings change
69- name: Set the unicode language to English Great Britain, reboot if required
70  community.windows.win_region:
71    unicode_language: en-GB
72  register: result
73
74- ansible.windows.win_reboot:
75  when: result.restart_required
76
77# Reboot when format, location or unicode has changed
78- name: Set format, location and unicode to English Australia and copy settings, reboot if required
79  community.windows.win_region:
80    location: 12
81    format: en-AU
82    unicode_language: en-AU
83  register: result
84
85- ansible.windows.win_reboot:
86  when: result.restart_required
87'''
88
89RETURN = r'''
90restart_required:
91    description: Whether a reboot is required for the change to take effect.
92    returned: success
93    type: bool
94    sample: true
95'''
96