============================================================================
//從bao文件里上傳安裝包
[root@001 ansible]# yum -y localinstall *.rpm
[root@001 ansible]# ssh-keygen
[root@001 ansible]# ssh-copy-id root@192.168.88.102
[root@001 ansible]# ssh-copy-id 192.168.88.103
[root@001 ansible]# cd /etc/ansible/
[root@001 ansible]# vim ansible.cfg
---private_key_file=/root/.ssh/id_rsa # 定義ssh信任文件所在位置
[root@001 ansible]# vim hosts # 在配置文件內(nèi)追加以下內(nèi)容
---[tay]
---192.168.88.102
---192.168.88.103
[root@001 ansible]# ansible tay -m command -a "uptime"
=========================================================================
yum安裝版
第一步:安裝163源走贪,因?yàn)楸镜毓獗P中沒有epel源的安裝包---加載163源緩存
第二步:安裝epel源,因?yàn)橹挥衑pel源中才有ansible的yum安裝---加載epel源緩存
第三步:yum install -y ansible
第四步:修改/etc/ansible/ansible.cfg
第五步:修改/etc/ansible/hosts
第六步:ssh-keygen(生成本地ssh秘鑰)
第七步:ssh-copy-id root@xxx.xxx.xxx.xxx(與遠(yuǎn)程主機(jī)建立連接)
第八步:ansible tay -m command -a "uptime"