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