ansible实现SSH配置免密互信
Ansible是用来处理大批量重复性操作的工具,只需要在一台机器上就可以远程控制所有机器,但前提是必须保证每台机器之间SSH可以相互免密登录。关于Ansible的安装和环境准备请参考Ansible环境的准备。
注: 有关Ansible的所有操作只需在第一台机器上修改和执行,其它机器只需知道IP地址即可。
免密安装机器
172.18.18.120
172.18.18.121
172.18.18.122
配置所有免密机器用户名及密码
编辑/etc/ansible/hosts 文件增加配置如下:
[ssh]
172.18.18.120 ansible_ssh_user=root ansible_ssh_pass=123456
172.18.18.121 ansible_ssh_user=root ansible_ssh_pass=123456
172.18.18.122 ansible_ssh_user=root ansible_ssh_pass=123456
编写yml执行文件
编辑/opt/ansible/sshKey.yml文件如下:
- hosts: ssh tasks: |
执行免密安装
ansible-playbook /opt/ansible/sshKey.yml
最新文章
- 一鼓作气 博客--第八篇 note8
- 关于spring中无法将service注入到servlet中的问题
- Java 线程 — AbstractQueuedSynchronizer
- 使用Tuple来实现多个Model传送至视图
- NOIP2012pj文化之旅[floyd]
- 集成学习(Ensembling Learning)
- PC/UVa 题号: 110106/10033 Interpreter (解释器)题解 c语言版
- 深入探索C++对象模型-5
- Python 写网络爬虫思路分析
- ACM做题过程中的一些小技巧
- MSSQL-最佳实践-Always Encrypted
- Topshelf的使用
- day2——两数相加
- 微信小程序笔记
- 数据结构~Sqlserver索引使用的B树
- dubbo学习笔记1
- TFS2017新特性(一)
- 和我一起打造个简单搜索之IK分词以及拼音分词
- xxx is not in sudoers file 解决(转)
- .NET Runtime version 2.0.50727.xxx 执行引擎错误。 (Fatal Execution Engine Error)