puppet ruby開發 salt python開發,有客戶端,使用Rabbitmq消息隊列,支持併發,在機器數量不少時效果比ansible好。 ansible python開發, 沒有客戶端,基於ssh,同時只能創建一個隧道,不支持併發,適於維護數量不是不少的機器。 -m 指定模塊 command 只支持單條命令 shell 支持管道符等 1.安裝 pip install ansible ansible --version 2.建立配置文件 mkdir /etc/ansible vim /etc/ansible/hosts 172.16.100.100 3.拷貝公鑰 ssh-keygen -t rsa ssh-copy-id -i id_rsa.pub -p 22 root@172.16.100.100 4.測試執行 [09:51:40] [root@ansible-server ~]# ansible all -m ping 172.16.100.100 | SUCCESS => { "changed": false, "failed": false, "ping": "pong" } 默認使用command模塊,只能運行一條命令。 -m 使用shell模塊,-a指定模塊參數,支持多條命令。 [09:57:13] [root@ansible-server ~]# ansible all -m shell -a "ls -l && ls -l /" 172.16.100.100 | SUCCESS | rc=0 >> 總用量 150056 5.分組 inventory [10:02:26] [root@ansible-server ~]# vim /etc/ansible/hosts [vpsgroup] 172.16.100.100 [10:03:28] [root@ansible-server ~]# ansible vpsgroup -m shell -a "ls" [10:07:47] [root@ansible-server ~]# ansible 172.16.100.100 -m shell -a "ls" requests庫 1.安裝 pip install requests yum install python-devel pip install gunicorn httpbin gunicorn httpbin:app -b 172.17.52.88:8000