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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM