Om de Windows Time Zone in te stellen kunnen we Ansible gebruiken. Maak hiervoor een taak in bv. roles/common/tasks/main.yml
- name: Set timezone to 'W. Europe Standard Time' (GMT+01:00) win_timezone: timezone: W. Europe Standard Time
Deze rol gaan we includen in een playbook genaamd win-timezone.yml:
- hosts: windows gather_facts: False roles: - { role: common, tags: 'common' }
De tree ziet er dan alsvolgt uit:
. ├── ansible.cfg ├── win-timezone.yml ├── group_vars │ └── windows.yml ├── inventory └── roles └── common └── tasks └── main.yml
Het commando om de tijdzone in te stellen op server hyper-v01:
ansible-playbook win-timezone.yml -l hyper-v01.digitalinfo.local
met als resultaat:
PLAY [windows] ************************************************************************************************************************************************************************************************ TASK [common : Set timezone to 'W. Europe Standard Time' (GMT+01:00)] ******************************************************************************************************************************************* changed: [hyper-v01.digitalinfo.local] PLAY RECAP **************************************************************************************************************************************************************************************************** hyper-v01.digitalinfo.local : ok=2 changed=1 unreachable=0 failed=0