【发布时间】:2020-12-20 02:16:42
【问题描述】:
在 Ubuntu 18.04 上使用最新的 Ansible 2.9.12
已按照步骤设置无密码 ssh,我在服务器和节点机器上拥有相同的用户。
a@A:~> ssh-keygen -t rsa
a@A:~> ssh b@B mkdir -p .ssh
b@B's password:
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password:
a@A:~> ssh b@B <- this works
$ ansible -m ping all
尝试执行一个基本的 ansible 命令:
$ ansible -b all -m apt -a "name=apache2 state=latest"
192.168.37.129 | FAILED! => {
"msg": "Missing sudo password"
$ ansible -b all -m apt -a "name=apache2 state=latest" -kk
SSH password:
192.168.37.129 | FAILED! => {
**"msg": "Missing sudo password"
我在这里缺少什么?我应该在节点机器中创建一个新的/不同的用户吗?
【问题讨论】:
-
您似乎混淆了
ssh和sudo。您可能已经将ssh配置为无需密码即可工作,但在您的问题中没有显示您如何将 sudo` 配置为无需密码即可工作。