Open europ opened 7 months ago
Improper string handling (evaluation) in community.windows.win_timezone.
A string that includes white spaces is split apart and the extracted first field (field separator is white space) only is used.
$ ansible --version ansible [core 2.16.1] config file = /mnt/ansible/ansible.cfg configured module search path = ['/home/****/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.11/site-packages/ansible ansible collection location = /home/****/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible python version = 3.11.5 (main, Nov 15 2023, 18:13:17) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20.0.1)] (/usr/bin/python3.11) jinja version = 3.1.2 libyaml = True
$ ansible-galaxy collection list # /home/***/.ansible/collections/ansible_collections Collection Version -------------------- ------- community.windows 2.1.0
$ ansible-config dump --only-changed CONFIG_FILE() = /mnt/ansible/ansible.cfg DEFAULT_ROLES_PATH(/mnt/ansible/ansible.cfg) = ['/mnt/ansible/roles'] INVENTORY_IGNORE_EXTS(/mnt/ansible/ansible.cfg) = ["{{(REJECT_EXTS + ('.orig'", '.cfg', "'.retry'))}}"]
- name: configure timezone community.windows.win_timezone: timezone: '{{ timezone }}'
ansible-playbook -i ./inventory ./playbook.yml -e timezone='Pacific Standard Time' -vvv
changed: [1.1.1.1] => { "changed": true, "previous_timezone": "UTC", "timezone": "Pacific Standard Time" }
fatal: [1.1.1.1]: FAILED! => { "changed": false, "msg": "The specified timezone: Pacific isn't supported on the machine.", "previous_timezone": "UTC", "timezone": "Pacific" }
Using single quotation marks within double quotation marks solves the problem.
ansible-playbook -i ./inventory ./playbook.yml -e timezone="'Pacific Standard Time'" -vvv
SUMMARY
Improper string handling (evaluation) in community.windows.win_timezone.
A string that includes white spaces is split apart and the extracted first field (field separator is white space) only is used.
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
WORKAROUND
Using single quotation marks within double quotation marks solves the problem.