ansible踩坑指南

1.ansible Missing sudo password

  1.1尝试使用该选项-kK。它将提示输入密码。

$ ansible-playbook mail.yml -kK 
SSH password: 
BECOME password[defaults to SSH password]: 
  • -k,--ask-pass:询问连接密码
  • -K,--ask-become-pass:询问特权升级密码

1.2  You can specificy the sudo password when running the Ansible playbook:

ansible-playbook playbook.yml -i inventory.ini --extra-vars "ansible_sudo_pass=yourPassword"

  1.3将此添加到您的/ etc / sudoers文件

## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL

## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL
username-u-want-to-allow        ALL=(ALL)       NOPASSWD: ALL

 2. ansible出现Failed to connect to the host via ssh

  2.1 公钥验证出现问题一般检查selinux是否关闭,还有就是authorized_keys权限是否为600

 

3.报错

Permissions 0755 for '/root/ansible/cers/devops_id_rs' are too open.\r\nIt is required that your private key files are NOT accessible by others.\r\nThis private key will be ignored

Keys need to be only readable by you:

chmod 400 ~/.ssh/id_rsa

If Keys need to be read-writable by you:

chmod 600 ~/.ssh/id_rsa

https://stackoverflow.com/questions/9270734/ssh-permissions-are-too-open-error

 

4.Failed to connect to the host via ssh: Host key verification failed

In your ansible config file /var/lib/jenkins/workspace/FPipeline/ansible.cfg add below line and test it again.

[defaults]
host_key_checking = False

https://stackoverflow.com/questions/46929624/failed-to-connect-to-the-host-via-ssh-host-key-verification-failed-r-n/46933307

 

5.

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值