reko_3 发表于 2018-7-30 13:10:17

批量命令行执行工具ansible-shell

$ sudo ansible-shell# 进入命令行  
root@ (0)$ list groups# 列出主机组
  
all
  
ceshi
  
game
  
ungrouped
  
test
  
root@ (0)$ cd ceshi    # 进入ceshi主机组
  
root@ceshi (2)$ list# 列出该组的所有主机
  
10.4.2.123
  
10.4.13.105
  
root@ceshi (2)$ date# 执行date
  
=============== 10.4.13.105         ================
  
Wed Aug8 14:48:13 CST 2014
  

  
=============== 10.4.2.144          ================
  
Wed Aug8 14:52:21 CST 2014
  

  
root@ceshi (2)$ raw mysql -uUSER -pPASSWORD -e "show databases;"      # 使用raw模块执行任意shell命令
  
=============== 10.4.2.123          ================
  
+--------------------+
  
| Database         |
  
+--------------------+
  
| information_schema |
  
| ceshi_db         |
  
| mysql            |
  
| performance_schema |
  
| test               |
  
+--------------------+
  

  
=============== 10.4.13.105         ================
  
+--------------------+
  
| Database         |
  
+--------------------+
  
| information_schema |
  
| ceshi_db         |
  
| mysql            |
  
| performance_schema |
  
+--------------------+
页: [1]
查看完整版本: 批量命令行执行工具ansible-shell