Repository: ansible/ansible

Issue:
module timezone doesnt work with SLES11SP4
##### ISSUE TYPE

 - Bug Report

##### COMPONENT NAME

timezone module

##### ANSIBLE VERSION

```
ansible 2.4.3.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]

```

##### CONFIGURATION

NA

##### OS / ENVIRONMENT

Ubuntu 17.10

##### SUMMARY

timezone module produces an error when used on SLES 11 (SP4)
It seems that the module searches for "ZONE" in /etc/sysconfig/clock, but in SLES11 the parameter is named "TIMEZONE" (found in line 356 in timezone.py), there is also no section for SLES11. On SLES12 the module is working correctly

##### STEPS TO REPRODUCE

run a playbook that uses the timezone module against a SLES11SP4 machine

<!--- Paste example playbooks or commands between quotes below -->
```yaml
  tasks:

  - name: set timezone to UTC
    timezone:
      name: UTC
```

##### EXPECTED RESULTS

changing the timezone with no errors

##### ACTUAL RESULTS

playbook ends with an error
```
fatal: [al-sles11sp4.fritz.box]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "hwclock": null,
            "name": "UTC"
        }
    },
    "msg": "Error message:\ncannot find the valid value from configuration file \"/etc/sysconfig/clock\" for name"
```
Full Output:
```
58# ansible-playbook timezone.yml --ask-pass -vvv
ansible-playbook 2.4.3.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]
Using /etc/ansible/ansible.cfg as config file
SSH password:
Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: timezone.yml ******************************************************************************************************************************************************************************
1 plays in timezone.yml

PLAY [al-sles11sp4.fritz.box] ***********************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************************
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py
<al-sles11sp4.fritz.box> ESTABLISH SSH CONNECTION FOR USER: root
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 al-sles11sp4.fritz.box '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<al-sles11sp4.fritz.box> (0, '/root\n', '')
<al-sles11sp4.fritz.box> ESTABLISH SSH CONNECTION FOR USER: root
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 al-sles11sp4.fritz.box '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1518706789.4-189978801194717 `" && echo ansible-tmp-1518706789.4-189978801194717="` echo /root/.ansible/tmp/ansible-tmp-1518706789.4-189978801194717 `" ) && sleep 0'"'"''
<al-sles11sp4.fritz.box> (0, 'ansible-tmp-1518706789.4-189978801194717=/root/.ansible/tmp/ansible-tmp-1518706789.4-189978801194717\n', '')
<al-sles11sp4.fritz.box> PUT /tmp/tmppSyTyW TO /root/.ansible/tmp/ansible-tmp-1518706789.4-189978801194717/setup.py
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 '[al-sles11sp4.fritz.box]'
<al-sles11sp4.fritz.box> (0, 'sftp> put /tmp/tmppSyTyW /root/.ansible/tmp/ansible-tmp-1518706789.4-189978801194717/setup.py\n', '')
<al-sles11sp4.fritz.box> ESTABLISH SSH CONNECTION FOR USER: root
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 al-sles11sp4.fritz.box '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1518706789.4-189978801194717/ /root/.ansible/tmp/ansible-tmp-1518706789.4-189978801194717/setup.py && sleep 0'"'"''
<al-sles11sp4.fritz.box> (0, '', '')
<al-sles11sp4.fritz.box> ESTABLISH SSH CONNECTION FOR USER: root
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 -tt al-sles11sp4.fritz.box '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1518706789.4-189978801194717/setup.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1518706789.4-189978801194717/" > /dev/null 2>&1 && sleep 0'"'"''
<al-sles11sp4.fritz.box> (0, 'exc: \'DistributionFiles\' object has no attribute \'parse_distribution_file_Archlinux\'\r\n\r\n{"invocation": {"module_args": {"filter": "*", "gather_subset": ["all"], "fact_path": "/etc/ansible/facts.d", "gather_timeout": 10}}, "ansible_facts": {"ansible_product_serial": "0", "ansible_form_factor": "Other", "ansible_distribution_file_parsed": true, "ansible_fips": false, "ansible_service_mgr": "sysvinit", "ansible_user_id": "root", "ansible_selinux_python_present": false, "ansible_userspace_bits": "64", "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQC21xdbi2F4AX5tkTbDMQ8y/KrCek2xeaqjw89gbb8EvKdL2thgczD1xhg40C69ubACcHm4QWmzfKSXjexa9eQrpWnsYjJA+79lrTQHql4TOphi9JH15FN/0JFOrpbyIfIE6shGLY+F1EZf3QhxrMdBJTI8zJkV4f8v0H33xLGCWEQDchyax9nnOLKk4GkNE6sGDczIczgDAs82c+NmuLn4If4B+Z4hEdZYP3BtXnUJ7VdWhqyWTCjo+jXzou2/Cz19lC4vMUXfidvxXoN+oqdYT1suBoYi53CpTP6Gf8DWk2KKv67+3aHsA8m+VvwVpaSVDRJbFxaFXWzJ2TTqMZT/", "gather_subset": ["all"], "ansible_real_user_id": 0, "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL0rQyUGKhKweTCeD7ONSZNtePZheL4rXBWUtpvGs6n77ZasmacYvqpLpp8wEHBhiUHfyZqxNz4uYCdNbufhjHU=", "ansible_local": {}, "ansible_distribution_version": "11.4", "ansible_domain": "", "ansible_distribution_file_path": "/etc/os-release", "ansible_user_shell": "/bin/bash", "ansible_date_time": {"weekday_number": "4", "iso8601_basic_short": "20180215T100002", "tz": "EST", "weeknumber": "07", "hour": "10", "year": "2018", "minute": "00", "tz_offset": "-0500", "month": "02", "epoch": "1518706802", "iso8601_micro": "2018-02-15T15:00:02.080653Z", "weekday": "Thursday", "time": "10:00:02", "date": "2018-02-15", "iso8601": "2018-02-15T15:00:02Z", "day": "15", "iso8601_basic": "20180215T100002080582", "second": "02"}, "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIMHefxbetdtMIGi8agAqTRQqepZDaYgHkHJCSRKDRLYv", "ansible_processor_cores": 1, "ansible_virtualization_role": "guest", "ansible_distribution_file_variety": "SuSE", "ansible_env": {"LS_COLORS": "no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:", "LESS": "-M -I", "MINICOM": "-c on", "CSHEDIT": "emacs", "HOSTTYPE": "x86_64", "LESSOPEN": "lessopen.sh %s", "SSH_CLIENT": "192.168.178.169 49618 22", "LOGNAME": "root", "USER": "root", "INPUTRC": "/etc/inputrc", "HOME": "/root", "PATH": "/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin", "CPU": "x86_64", "LANG": "en_US.UTF-8", "INFOPATH": "/usr/local/info:/usr/share/info:/usr/info", "TERM": "xterm", "SHELL": "/bin/bash", "SHLVL": "2", "G_BROKEN_FILENAMES": "1", "HISTSIZE": "1000", "LESS_ADVANCED_PREPROCESSOR": "no", "MANPATH": "/usr/share/man:/usr/local/man", "OSTYPE": "linux", "PROFILEREAD": "true", "INFODIR": "/usr/local/info:/usr/share/info:/usr/info", "PYTHONPATH": "/tmp/ansible_yV207i/ansible_modlib.zip", "NNTPSERVER": "news", "G_FILENAME_ENCODING": "@locale,UTF-8,ISO-8859-15,CP1252", "HOST": "sles11sp4", "FROM_HEADER": "", "ENV": "/etc/bash.bashrc", "LESSKEY": "/etc/lesskey.bin", "XDG_CONFIG_DIRS": "/etc/xdg", "LS_OPTIONS": "-A -N --color=tty -T 0", "XNLSPATH": "/usr/X11R6/lib/X11/nls", "_": "/usr/bin/python", "MACHTYPE": "x86_64-suse-linux", "LESSCLOSE": "lessclose.sh %s %s", "PYTHONSTARTUP": "/etc/pythonstart", "SSH_TTY": "/dev/pts/1", "HOSTNAME": "sles11sp4", "SSH_SENDS_LOCALE": "yes", "XDG_DATA_DIRS": "/usr/share", "PWD": "/root", "PAGER": "less", "COLORTERM": "1", "MAIL": "/var/mail/root", "SSH_CONNECTION": "192.168.178.169 49618 192.168.178.170 22", "XKEYSYMDB": "/usr/share/X11/XKeysymDB", "MORE": "-sl"}, "ansible_effective_group_id": 0, "ansible_bios_version": "VirtualBox", "ansible_processor": ["0", "GenuineIntel", "Intel(R) Core(TM) i7-4712MQ CPU @ 2.30GHz"], "ansible_virtualization_type": "virtualbox", "ansible_lo": {"features": {"generic_receive_offload": "on", "tx_checksumming": "on", "large_receive_offload": "off", "rx_checksumming": "on", "udp_fragmentation_offload": "on", "generic_segmentation_offload": "on", "tx_nocache_copy": "off", "tcp_segmentation_offload": "on", "rx_vlan_offload": "off", "scatter_gather": "on", "ntuple_filters": "off", "tx_vlan_offload": "off", "receive_hashing": "off"}, "promisc": false, "mtu": 16436, "device": "lo", "ipv4_secondaries": [{"broadcast": "127.255.255.255", "netmask": "255.0.0.0", "network": "127.0.0.0", "address": "127.0.0.2"}, {"broadcast": "127.255.255.255", "netmask": "255.0.0.0", "network": "127.0.0.0", "address": "127.0.0.2"}], "ipv4": {"broadcast": "127.255.255.255", "netmask": "255.0.0.0", "network": "127.0.0.0", "address": "127.0.0.1"}, "ipv6": [{"scope": "host", "prefix": "128", "address": "::1"}], "active": true, "type": "loopback"}, "ansible_memtotal_mb": 868, "ansible_architecture": "x86_64", "ansible_device_links": {"masters": {}, "labels": {"sr0": ["SLES-11-SP4-DVD-x86_6412211"]}, "ids": {"sda2": ["ata-VBOX_HARDDISK_VB77b05cf9-f4ee2296-part2", "scsi-1ATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296-part2", "scsi-SATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296-part2"], "sda": ["ata-VBOX_HARDDISK_VB77b05cf9-f4ee2296", "scsi-1ATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296", "scsi-SATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296"], "sda1": ["ata-VBOX_HARDDISK_VB77b05cf9-f4ee2296-part1", "scsi-1ATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296-part1", "scsi-SATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296-part1"]}, "uuids": {"sda2": ["dfded49d-b5e7-4af5-9cfb-ef0c848cd135"], "sda1": ["ed2d12a8-d58b-4f64-94a9-c2a0b2b87c63"]}}, "ansible_default_ipv4": {"macaddress": "08:00:27:7d:e9:84", "network": "192.168.178.0", "mtu": 1500, "broadcast": "192.168.178.255", "alias": "eth0", "netmask": "255.255.255.0", "address": "192.168.178.170", "interface": "eth0", "type": "ether", "gateway": "192.168.178.1"}, "ansible_swapfree_mb": 994, "ansible_default_ipv6": {}, "ansible_distribution_release": "4", "ansible_system_vendor": "innotek GmbH", "ansible_apparmor": {"status": "disabled"}, "ansible_cmdline": {"splash": "silent", "root": "/dev/disk/by-id/ata-VBOX_HARDDISK_VB77b05cf9-f4ee2296-part2", "vga": "0x314", "resume": "/dev/disk/by-id/ata-VBOX_HARDDISK_VB77b05cf9-f4ee2296-part1", "crashkernel": "256M-:128M"}, "ansible_effective_user_id": 0, "ansible_user_gid": 0, "ansible_selinux": {"status": "Missing selinux Python library"}, "ansible_product_version": "1.2", "ansible_os_family": "Suse", "ansible_userspace_architecture": "x86_64", "ansible_product_uuid": "D847B661-9F01-46B2-84FE-7EE93849CFD2", "ansible_system": "Linux", "ansible_pkg_mgr": "zypper", "ansible_memfree_mb": 704, "ansible_devices": {"sr0": {"scheduler_mode": "cfq", "rotational": "1", "vendor": "VBOX", "sectors": "6610944", "links": {"masters": [], "labels": ["SLES-11-SP4-DVD-x86_6412211"], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)", "sectorsize": "2048", "removable": "1", "support_discard": "0", "holders": [], "partitions": {}, "model": "CD-ROM", "serial": "VBOX", "size": "3.15 GB"}, "sda": {"scheduler_mode": "cfq", "rotational": "1", "vendor": "ATA", "sectors": "16777216", "links": {"masters": [], "labels": [], "ids": ["ata-VBOX_HARDDISK_VB77b05cf9-f4ee2296", "scsi-1ATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296", "scsi-SATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296"], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 02)", "sectorsize": "512", "removable": "0", "support_discard": "0", "holders": [], "partitions": {"sda2": {"sectorsize": 512, "uuid": "dfded49d-b5e7-4af5-9cfb-ef0c848cd135", "links": {"masters": [], "labels": [], "ids": ["ata-VBOX_HARDDISK_VB77b05cf9-f4ee2296-part2", "scsi-1ATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296-part2", "scsi-SATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296-part2"], "uuids": ["dfded49d-b5e7-4af5-9cfb-ef0c848cd135"]}, "sectors": "14737408", "start": "2039808", "holders": [], "size": "7.03 GB"}, "sda1": {"sectorsize": 512, "uuid": "ed2d12a8-d58b-4f64-94a9-c2a0b2b87c63", "links": {"masters": [], "labels": [], "ids": ["ata-VBOX_HARDDISK_VB77b05cf9-f4ee2296-part1", "scsi-1ATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296-part1", "scsi-SATA_VBOX_HARDDISK_VB77b05cf9-f4ee2296-part1"], "uuids": ["ed2d12a8-d58b-4f64-94a9-c2a0b2b87c63"]}, "sectors": "2037760", "start": "2048", "holders": [], "size": "995.00 MB"}}, "model": "VBOX HARDDISK", "serial": "VB77b05cf9", "size": "8.00 GB"}, "loop3": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop2": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop1": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop0": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop7": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop6": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop5": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop4": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}}, "ansible_user_uid": 0, "ansible_lvm": {"pvs": {}, "lvs": {}, "vgs": {}}, "ansible_distribution": "SLES", "ansible_user_dir": "/root", "ansible_dns": {"nameservers": ["192.168.178.1"], "search": ["fritz.box"]}, "ansible_distribution_major_version": "11", "module_setup": true, "ansible_processor_count": 1, "ansible_hostname": "sles11sp4", "ansible_processor_vcpus": 1, "ansible_swaptotal_mb": 994, "ansible_lsb": {}, "ansible_real_group_id": 0, "ansible_bios_date": "12/01/2006", "ansible_all_ipv6_addresses": ["fe80::a00:27ff:fe7d:e984"], "ansible_interfaces": ["lo", "eth0"], "ansible_uptime_seconds": 620, "ansible_machine_id": "dae8503b4533eb63e35377095a859c61", "ansible_kernel": "3.0.101-63-default", "ansible_memory_mb": {"real": {"total": 868, "used": 164, "free": 704}, "swap": {"cached": 0, "total": 994, "free": 994, "used": 0}, "nocache": {"used": 83, "free": 785}}, "ansible_user_gecos": "root", "ansible_python": {"executable": "/usr/bin/python", "version": {"micro": 9, "major": 2, "releaselevel": "final", "serial": 0, "minor": 6}, "type": "CPython", "has_sslcontext": false, "version_info": [2, 6, 9, "final", 0]}, "ansible_processor_threads_per_core": 1, "ansible_fqdn": "sles11sp4", "ansible_mounts": [{"block_used": 425979, "uuid": "N/A", "size_total": 7427108864, "block_total": 1813259, "mount": "/", "block_available": 1387280, "size_available": 5682298880, "fstype": "ext3", "inode_total": 460560, "options": "rw,acl,user_xattr", "device": "/dev/sda2", "inode_used": 57541, "block_size": 4096, "inode_available": 403019}], "ansible_eth0": {"macaddress": "08:00:27:7d:e9:84", "features": {"generic_receive_offload": "on", "tx_checksumming": "on", "large_receive_offload": "off", "rx_checksumming": "off", "udp_fragmentation_offload": "off", "generic_segmentation_offload": "on", "tx_nocache_copy": "off", "tcp_segmentation_offload": "on", "rx_vlan_offload": "on", "scatter_gather": "on", "ntuple_filters": "off", "tx_vlan_offload": "on", "receive_hashing": "off"}, "type": "ether", "pciid": "0000:00:03.0", "module": "e1000", "mtu": 1500, "device": "eth0", "promisc": false, "ipv4": {"broadcast": "192.168.178.255", "netmask": "255.255.255.0", "network": "192.168.178.0", "address": "192.168.178.170"}, "ipv6": [{"scope": "link", "prefix": "64", "address": "fe80::a00:27ff:fe7d:e984"}], "active": true, "speed": 1000}, "ansible_nodename": "sles11sp4", "ansible_product_name": "VirtualBox", "ansible_machine": "x86_64", "ansible_ssh_host_key_dsa_public": "AAAAB3NzaC1kc3MAAACBAJUHppiCYNqSlWsKnYSPVXXn7nX/mMEpMofe5wt218Fu9zYUBuj48ovun8rjJTiTM71g06WclKHtI8Vd1Jbrrcb1lMsoZLyLU6XZeKSQwxbQx6odFy3wUlEceXqKb7FXfQ7j6la+GfHQl2vLVS0K2CtkYagCKTgO7bATLwxLcsIJAAAAFQDDGylyy6nGIl4b1KW13CEtSJ0mjwAAAIBmVqk3XrsxsX6j5flTxiz4FI2236ZzRF8bEfZT34MolMvXUhxM0RBbdIR8qrs1mSZ+TvmkEl8be053EqYtY8UzxqOZZkTJTWesVmPrQAp2w6JH5SY0fswMALl2CHx06BUtIdIp6O9Ab7OpH7qh7vsGQO8lVRFGREu3sMM4dFvrMAAAAIA0ttTilR7c55JV9EqAkeKKNk8/yvz8pUdReUgT/QaToIuZZfYO9yMA35j4kEb1FqiiCujMeyMTBxA2oXytc7c0G87rLsRY6GYGmttnJG/NSft6uMZSBBwdHlAvtO7ZWNhKJfKzexins788+JRiFmX8yBe+DfQM7HSkyX/U7yIRBA==", "ansible_all_ipv4_addresses": ["192.168.178.170"], "ansible_python_version": "2.6.9"}}\r\n', 'Shared connection to al-sles11sp4.fritz.box closed.\r\n')
ok: [al-sles11sp4.fritz.box]
META: ran handlers

TASK [set timezone to UTC] **************************************************************************************************************************************************************************
task path: /root/ansible/timezone/timezone.yml:7
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/timezone.py
<al-sles11sp4.fritz.box> ESTABLISH SSH CONNECTION FOR USER: root
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 al-sles11sp4.fritz.box '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<al-sles11sp4.fritz.box> (0, '/root\n', '')
<al-sles11sp4.fritz.box> ESTABLISH SSH CONNECTION FOR USER: root
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 al-sles11sp4.fritz.box '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1518706792.17-88860384465916 `" && echo ansible-tmp-1518706792.17-88860384465916="` echo /root/.ansible/tmp/ansible-tmp-1518706792.17-88860384465916 `" ) && sleep 0'"'"''
<al-sles11sp4.fritz.box> (0, 'ansible-tmp-1518706792.17-88860384465916=/root/.ansible/tmp/ansible-tmp-1518706792.17-88860384465916\n', '')
<al-sles11sp4.fritz.box> PUT /tmp/tmpNL1rgH TO /root/.ansible/tmp/ansible-tmp-1518706792.17-88860384465916/timezone.py
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 '[al-sles11sp4.fritz.box]'
<al-sles11sp4.fritz.box> (0, 'sftp> put /tmp/tmpNL1rgH /root/.ansible/tmp/ansible-tmp-1518706792.17-88860384465916/timezone.py\n', '')
<al-sles11sp4.fritz.box> ESTABLISH SSH CONNECTION FOR USER: root
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 al-sles11sp4.fritz.box '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1518706792.17-88860384465916/ /root/.ansible/tmp/ansible-tmp-1518706792.17-88860384465916/timezone.py && sleep 0'"'"''
<al-sles11sp4.fritz.box> (0, '', '')
<al-sles11sp4.fritz.box> ESTABLISH SSH CONNECTION FOR USER: root
<al-sles11sp4.fritz.box> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/e460c6a1b5 -tt al-sles11sp4.fritz.box '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1518706792.17-88860384465916/timezone.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1518706792.17-88860384465916/" > /dev/null 2>&1 && sleep 0'"'"''
<al-sles11sp4.fritz.box> (0, '\r\n{"msg": "Error message:\\ncannot find the valid value from configuration file \\"/etc/sysconfig/clock\\" for name", "failed": true, "exception": "  File \\"/tmp/ansible_VM55R5/ansible_module_timezone.py\\", line 406, in get\\n    value = self.regexps[key].search(status).group(1)\\n", "invocation": {"module_args": {"hwclock": null, "name": "UTC"}}}\r\n', 'Shared connection to al-sles11sp4.fritz.box closed.\r\n')
The full traceback is:
  File "/tmp/ansible_VM55R5/ansible_module_timezone.py", line 406, in get
    value = self.regexps[key].search(status).group(1)

fatal: [al-sles11sp4.fritz.box]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "hwclock": null,
            "name": "UTC"
        }
    },
    "msg": "Error message:\ncannot find the valid value from configuration file \"/etc/sysconfig/clock\" for name"
}
        to retry, use: --limit @/root/ansible/timezone/timezone.retry

PLAY RECAP ******************************************************************************************************************************************************************************************
al-sles11sp4.fritz.box     : ok=1    changed=0    unreachable=0    failed=1

```
##### Content of /etc/sysconfig/clock on SLES11SP4
```
sles11sp4:~ # cat /etc/sysconfig/clock
## Path:                System/Environment/Clock
## Description:         Information about your timezone and time
## Type:                string(-u,--utc,--localtime)
## ServiceRestart:      boot.clock
## Command:             /sbin/refresh_initrd
#
# Set to "-u" if your system clock is set to UTC, and to "--localtime"
# if your clock runs that way.
#
HWCLOCK="-u"

## Type:                yesno
## Default:             yes
## Description: Write back system time to the hardware clock
#
# Is set to "yes" write back the system time to the hardware
# clock at reboot or shutdown. Usefull if hardware clock is
# much more inaccurate than system clock.  Set to "no" if
# system time does it wrong due e.g. missed timer interrupts.
# If set to "no" the hardware clock adjust feature is also
# skipped because it is rather useless without writing back
# the system time to the hardware clock.
#
SYSTOHC="yes"

## Type:                string(Europe/Berlin,Europe/London,Europe/Paris)
## ServiceRestart:      boot.clock
#
# Timezone (e.g. CET)
# (this will set /usr/lib/zoneinfo/localtime)
#
TIMEZONE="America/New_York"
DEFAULT_TIMEZONE="US/Eastern"
```



Discussion:
Files identified in the description:
* [lib/ansible/modules/system/timezone.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/system/timezone.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @indrajitr @jasperla @tmshn
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
@ahotzler 

> OS / ENVIRONMENT
> Ubuntu 17.10
> 
> SUMMARY
> timezone module produces an error when used on SLES 11 (SP4)

Do you mean

- Host machine: Ubuntu 17.10
- Target machine: SUSE linux enterprise server

right?
right, target is SUSE Linux Enterprise Server 11, the problem didnt happen on SUSE Linux Enterprise Server 12 (because of systemd). We were also able to reproduce this when using Centos 7.4 on the Host.

Resolving patch:
diff --git a/lib/ansible/modules/system/timezone.py b/lib/ansible/modules/system/timezone.py
--- a/lib/ansible/modules/system/timezone.py
+++ b/lib/ansible/modules/system/timezone.py
@@ -344,7 +344,7 @@ def __init__(self, module):
             self.regexps['name'] = re.compile(r'^([^\s]+)', re.MULTILINE)
             self.tzline_format = '%s\n'
         else:
-            # RHEL/CentOS
+            # RHEL/CentOS/SUSE
             if self.module.get_bin_path('tzdata-update') is not None:
                 self.update_timezone = [self.module.get_bin_path('tzdata-update', required=True)]
                 self.allow_no_file['name'] = True
@@ -353,8 +353,19 @@ def __init__(self, module):
             #   self.allow_no_file['name'] = False <- this is default behavior
             self.conf_files['name'] = '/etc/sysconfig/clock'
             self.conf_files['hwclock'] = '/etc/sysconfig/clock'
-            self.regexps['name'] = re.compile(r'^ZONE\s*=\s*"?([^"\s]+)"?', re.MULTILINE)
-            self.tzline_format = 'ZONE="%s"\n'
+            # The key for timezone might be `ZONE` or `TIMEZONE`
+            # (the former is used in RHEL/CentOS and the latter is used in SUSE linux).
+            # So check the content of /etc/sysconfig/clock and decide which key to use.
+            with open(self.conf_files['name'], mode='r') as f:
+                sysconfig_clock = f.read()
+            if re.search(r'^TIMEZONE\s*=', sysconfig_clock, re.MULTILINE):
+                # For SUSE
+                self.regexps['name'] = re.compile(r'^TIMEZONE\s*=\s*"?([^"\s]+)"?', re.MULTILINE)
+                self.tzline_format = 'TIMEZONE="%s"\n'
+            else:
+                # For RHEL/CentOS
+                self.regexps['name'] = re.compile(r'^ZONE\s*=\s*"?([^"\s]+)"?', re.MULTILINE)
+                self.tzline_format = 'ZONE="%s"\n'
 
     def _allow_ioerror(self, err, key):
         # In some cases, even if the target file does not exist,


Test patch: