Buggy timezone module in Ansible

George Shuklin
OpsOps
Published in
1 min readJan 31, 2018

If you ever saw this:

fatal: [server]: FAILED! => {"changed": false, "msg": "Error message:\nstill not desired state, though changes have made\nOther message(s):\nAdded 1 line and deleted 1 line(s) on /etc/timezone"}

There are two options:

  1. It’s a bug. Sorry. 1, 2, etc. Sorry, it it is.
  2. You are using wrong the timezone name. It was a bit of mystery to debug.

I had following task:

tasks:
- name: Set UTC timezone
timezone: name=UTC
become: yes
tags:
- time

And it caused this cryptic error: “still not desired state, though changes have made” on some servers.

After some debug I found problem: time zone name was wrong. It’s not UTC, it’s Etc/UTC.

The proper task looks like this:

tasks:
- name: Set UTC timezone
timezone: name=Etc/UTC
become: yes
tags:
- time

After that all problems have been solved.

--

--

George Shuklin
OpsOps

I work at Servers.com, most of my stories are about Ansible, Ceph, Python, Openstack and Linux. My hobby is Rust.