Ansible是一个批量部署的工具html
参考:Ansible中文权威指南vim
1.安装bash
sudo apt-get install software-properties-common sudo apt-add-repository ppa:ansible/ansible sudo apt-get update sudo apt-get install ansible
2.在/etc/ansible/hosts文件中添加服务器的ip服务器
vim /etc/ansible/hosts
3.须要将本身机器的~/.ssh/目录下公钥,即pub文件,添加到服务器的~/.
ssh
/authorized_keys
文件中ssh
vim ~/.ssh/authorized_keys
测试ssh是否能够免密登陆工具
4.测试可否ping通,以root用户登陆测试
ansible all -m ping -u root
5.测试创建一个test文件夹code
ansible all -u root -a "/bin/mkdir test"