使用ansible进行ssh用户身份登录连接至Linux主机出现以下报错
k8s-worker-01 | FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"module_stderr": "/home/nana/.bashrc: line 5: /etc/bashrc: Permission denied\nsudo: sorry, you must have a tty to run sudo\n"
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
解决方案,登录至客户端主机(被控制主机)
chmod 755 /etc/bashrc
chmod 755 /etc/sudoers
vim /etc/sudoers # 注释以下这行
...
#Defaults requiretty
...