fatal: [debian]: FAILED! => {"changed": false, "cmd": "/usr/bin/timedatectl set-timezone Asia/Tokyo", "failed": true, "msg": "Failed to set time zone: The name org.freedesktop.PolicyKit1 was not provided by any .service files", "rc": 1, "stderr": "Failed to set time zone: The name org.freedesktop.PolicyKit1 was not provided by any .service files\n", "stdout": "", "stdout_lines": []}
On CentOS 7 (centos/7
) - different from Debian:
TASK [set timezone to Asia/Tokyo] **********************************************
fatal: [centos]: FAILED! => {"changed": false, "cmd": "/usr/bin/timedatectl set-timezone Asia/Tokyo", "failed": true, "msg": "Failed to set time zone: Interactive authentication required.", "rc": 1, "stderr": "Failed to set time zone: Interactive authentication required.\n", "stdout": "", "stdout_lines": []}
On Ubuntu 16.04 (ubuntu/xenial64
) - same as CentOS, different from Debian:
TASK [set timezone to Asia/Tokyo] **********************************************
fatal: [ubuntu]: FAILED! => {"changed": false, "cmd": "/usr/bin/timedatectl set-timezone Asia/Tokyo", "failed": true, "msg": "Failed to set time zone: Interactive authentication required.", "rc": 1, "stderr": "Failed to set time zone: Interactive authentication required.\n", "stdout": "", "stdout_lines": []}
Am I missing something? Is there some dependency required?
timedatectl
needs sudo
privileges.
- name: set timezone to Asia/Tokyotimezone:name: Asia/Tokyobecome: yesbecome_method: sudo
Check if dbus package is installed (tested on Ubuntu):
dpkg -l dbus
and install it with:
apt-get install -y dbus
else you get a error:
# /usr/bin/timedatectlFailed to create bus connection: No such file or directory