tec*_*raf 7 ansible ansible-2.x
我决定重构一些剧本并尝试新timezone模块.
我尝试的任务是手册页中给出的示例的逐字副本:
- name: set timezone to Asia/Tokyo
timezone:
name: Asia/Tokyo
Run Code Online (Sandbox Code Playgroud)
它在我尝试的每个系统上都失败了.流浪机的结果:
在Debian 8(debian/jessie64)上:
任务[设定时区到亚洲/东京]******************************************
致命:[debian]:失败!=> {"已更改":false,"cmd":"/ usr/bin/timedatectl set-timezone Asia/Tokyo","failed":true,"msg":"无法设置时区:名称org.freedesktop .PolicyKit1不是由任何.service文件提供的","rc":1,"stderr":"无法设置时区:名称org.freedesktop.PolicyKit1未被任何.service文件提供\n","stdout ":"","stdout_lines":[]}
在CentOS 7(centos/7)上 - 与Debian不同:
任务[设定时区到亚洲/东京]******************************************
致命:[centos]:失败!=> {"已更改":false,"cmd":"/ usr/bin/timedatectl set-timezone Asia/Tokyo","failed":true,"msg":"无法设置时区:需要进行交互式身份验证." ,"rc":1,"stderr":"无法设置时区:需要交互式身份验证.\n","stdout":"","stdout_lines":[]}
在Ubuntu 16.04(ubuntu/xenial64)上 - 与CentOS相同,与Debian不同:
任务[设定时区到亚洲/东京]******************************************
致命:[ubuntu]:失败了!=> {"已更改":false,"cmd":"/ usr/bin/timedatectl set-timezone Asia/Tokyo","failed":true,"msg":"无法设置时区:需要进行交互式身份验证." ,"rc":1,"stderr":"无法设置时区:需要交互式身份验证.\n","stdout":"","stdout_lines":[]}
我错过了什么吗?是否需要一些依赖?
timedatectl需要sudo特权.
- name: set timezone to Asia/Tokyo
timezone:
name: Asia/Tokyo
become: yes
become_method: sudo
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2614 次 |
| 最近记录: |