桀昊j 发表于 2018-7-30 11:44:45

自动化运维工具之ansible-ly36843运维

#运行command模块  
# ansible web -m command -a 'date'
  
192.168.3.45 | success | rc=0 >>
  
Thu Jul2 14:22:27 CST 2015
  

  
192.168.3.46 | success | rc=0 >>
  
Thu Jul2 14:51:29 CST 2015
  

  
#运行shell模块
  
# ansible web -m shell -a 'iptables -L -n'
  
192.168.3.46 | success | rc=0 >>
  
Chain INPUT (policy ACCEPT)
  
target   prot opt source               destination
  
ACCEPT   all--0.0.0.0/0            0.0.0.0/0         state RELATED,ESTABLISHED
  
ACCEPT   icmp --0.0.0.0/0            0.0.0.0/0
  
ACCEPT   all--0.0.0.0/0            0.0.0.0/0
  
ACCEPT   tcp--0.0.0.0/0            0.0.0.0/0         state NEW tcp dpt:22
  
REJECT   all--0.0.0.0/0            0.0.0.0/0         reject-with icmp-host-prohibited
  

  
Chain FORWARD (policy ACCEPT)
  
target   prot opt source               destination
  
REJECT   all--0.0.0.0/0            0.0.0.0/0         reject-with icmp-host-prohibited
  

  
Chain OUTPUT (policy ACCEPT)
  
target   prot opt source               destination
  

  
192.168.3.45 | success | rc=0 >>
  
Chain INPUT (policy ACCEPT)
  
target   prot opt source               destination
  
ACCEPT   all--0.0.0.0/0            0.0.0.0/0         state RELATED,ESTABLISHED
  
ACCEPT   icmp --0.0.0.0/0            0.0.0.0/0
  
ACCEPT   all--0.0.0.0/0            0.0.0.0/0
  
ACCEPT   tcp--0.0.0.0/0            0.0.0.0/0         state NEW tcp dpt:22
  
REJECT   all--0.0.0.0/0            0.0.0.0/0         reject-with icmp-host-prohibited
  

  
Chain FORWARD (policy ACCEPT)
  
target   prot opt source               destination
  
REJECT   all--0.0.0.0/0            0.0.0.0/0         reject-with icmp-host-prohibited
  

  
Chain OUTPUT (policy ACCEPT)
  
target   prot opt source               destination
页: [1]
查看完整版本: 自动化运维工具之ansible-ly36843运维