ansible密码认证,为新系统添加key
2018-03-29 14:07
204 查看
1、在文件/etc/ansible/hosts中定义变量
示例:
[HOSTGROUP]
web[1:9].fun.com
[HOSTGROUP:vars]
ansible_ssh_user="fun"
ansible_ssh_pass="funpass"
2、添加认证key
ansible HOSTGROUP -m authorized-key -a "user=fun key={{ lookup('file', '~/.ssh/id_rsa.pub') }}"
错误:Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host.
1、安装sshpass模块:sudo yum install sshpass -y
2、修改配置文件:/etc/ansible/ansible.cfg
host_key_checking = False
ask_pass = True
示例:
[HOSTGROUP]
web[1:9].fun.com
[HOSTGROUP:vars]
ansible_ssh_user="fun"
ansible_ssh_pass="funpass"
2、添加认证key
ansible HOSTGROUP -m authorized-key -a "user=fun key={{ lookup('file', '~/.ssh/id_rsa.pub') }}"
错误:Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host.
1、安装sshpass模块:sudo yum install sshpass -y
2、修改配置文件:/etc/ansible/ansible.cfg
host_key_checking = False
ask_pass = True
相关文章推荐
- 动态添加 Redis 密码认证
- 动态添加Redis密码认证
- XP系统“管理我的网络密码”中没有“添加”按钮的故障
- MySql5.7在Windows系统中的安装、修改root密码、添加到系统服务
- ESB v6.6 关于“应用系统中增加账号及密码配置后,对应服务调用时允许进行账号及密码认证功能”
- WCF之添加自定义用户名密码认证
- 构建Postfix+Mysql+Dovecot邮件系统,实现以Web页面访问的功能、添加SASL认证以及TLS加密传输 推荐
- 为系统添加root用户密码
- 添加ssh无密码认证
- 如何为Linux系统中的SSH添加双重认证
- Windows系统下设置mysql的根用户密码及添加新用户的操作
- ssh public key认证免密码登录
- python 实例7 为rhel添加系统用户与登录密码,并给root 发送邮件
- Redis添加密码认证Cacti监控读取Redis状态值为-1的最快速解决方案
- 动态添加Redis密码认证的方法
- 【转】服务器添加新用户用ssh-key 登录,并禁用root用户 密码登录
- WAS7添加“登陆密码认证”方法
- vista忘记用户名密码的修改方法(使用PE进入系统,用cmd.exe冒充虚拟键盘,然后就可以mmc组策略,或者命令行添加用户并提升权限)