Ansible在Ubuntu上的安装

#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"
}

posted @ 2019-02-18 10:55  杨老板  阅读(2794)  评论(0编辑  收藏  举报