ansible - Ansible delegate_to “sudo 密码不正确”
问题描述
使用 ansible,我想为一组主机配置 rsyslog 服务,而不是将这些主机的名称添加到中央主机(不同于主机组),所以我的剧本:
- hosts: gourp_of_hosts
tasks:
- name: set rsyslog configuration
lineinfile:
path: /etc/rsyslog.conf
line: '{{item}}'
with_items:
- some items....
become: yes
- name: add host to rsyslog central
blockinfile:
path: /etc/rsyslog.conf
block: |
{{ansible_hostname}}....
delegate_to: x.x.x.x (my central host)
become: yes
我的清单文件包含主机组和我的中央主机:
[gourp_of_hosts]
host1 ansible_user=.... ansible_user_pass=.. ansible_sudo_pass=..
host2 ansible_user=.... ansible_user_pass=.. ansible_sudo_pass=..
[central]
x.x.x.x ansible_user=... ansible_user_pass=.. ansible_sudo_pass=..
现在我面临以下错误:
致命:[host1]:失败!=> {"msg": "sudo 密码错误"}
我尝试从我的清单文件中删除中央主机并使用ssh-copy-id user@x.x.x.x
结果我遇到以下错误:
致命:[主机]:无法访问!=> {"changed": false, "msg": "通过 ssh 连接主机失败:权限被拒绝 (publickey,gssapi-with-mic,password)。\r\n", "unreachable": true}
解决方案
推荐阅读
- c# - 有没有办法在重定向时将 LinkButton 内容从一个传递到另一个?
- java - Intellij Idea 自动为类创建链接设置器
- java - Java“分配和检查”的Kotlin等价物是什么?
- php - Laravel(nova)端点获取请求在浏览器中返回资源,但在单元测试中返回403
- installation - Tails OS 在引导时挂起
- arrays - 将 Firebase 数据存储为数组,然后使用此数组创建饼图
- intellij-idea - IntelliJ Idea:无法连接到存储库(SVN)
- php - PHP捕获字符之间的字符串
- javascript - 点击事件 legendselectchanged 时如何刷新 ECharts
- c++ - Boost Graph Lib在算法期间添加树顶点