#apt安装
apt-get install software-properties-common
apt-add-repository ppa:ansible/ansible
apt-get update
apt-get install ansible
安装完成以后简单配置 inventory
vim /etc/ansible/hosts
[localip]
192.168.107.150 ansible_ssh_private_key_file=/root/.ssh/id_rsa
[localhost]
localhost ansible_connection=local
在命令行测试
root@ubuntu:~# ansible all -m ping
[WARNING]: Found both group and host with same name: localhost
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
192.168.107.150 | SUCCESS => {
"changed": false,
"ping": "pong"
}