如何安裝ansible?

使用兩臺虛擬機
1.安裝
yum -y isntall ansible
2.創建公鑰
ssh-keygen -t rsa
3.生成以後
ssh-copy-id [email protected]
ssh-copy-id [email protected]
鏈接
ssh [email protected]
4.
vim /etc/ansible/hosts
[webservers]
192.168.159.111
192.168.159.112
5.繼續ping
ansible webservers -m ping
(綠色就是成功)
ansible webservers -m command -a ‘yum -y install httpd’
ansible webservers -m command -a ‘service httpd start’
ansible webservers -m command -a ‘service iptables stop’

發佈了12 篇原創文章 · 獲贊 8 · 訪問量 946
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章