Buggy timezone module in Ansible
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:
- It’s a bug. Sorry. 1, 2, etc. Sorry, it it is.
- 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.