Centos7 自動化工具 Ansible 安裝配置

實驗目的使用一臺服務器安裝Ansible來管理另外兩臺
Ansible服務端:192.168.31.10
節點:192.168.31.20 192.168.31.21

安裝Ansible

1.安裝elep源

yum -y install epel-release

2.安裝Asible

yum -y install ansible

配置

1.設置ssh密鑰,複製公鑰到節點

ssh-keygen #一路回車生成密鑰
ssh-copy-id -i root@192.168.31.20
ssh-copy-id -i root@192.168.31.21

2.配置ansible文件 /etc/ansible/hosts

[test-servers]
192.168.31.20
192.168.31.21

3.測試ansible

[root@qian1 ~] ansible -m ping 'test-servers'
192.168.31.21 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
^H192.168.31.20 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章