ansible 使用shell脚本提取受控制的服务器IP时,需要加入转义\
证明与ansible使用单双引号无关
[root@localhost ~]# ansible crushlinux -m shell -a "ifconfig ens33 | awk '/inet /{print \$2}' "
192.168.200.24 | CHANGED | rc=0 >>
192.168.200.24
192.168.200.21 | CHANGED | rc=0 >>
192.168.200.21
[root@localhost ~]# ansible crushlinux -m shell -a "ifconfig ens33 | awk '/inet /{print \$2}' "
192.168.200.21 | CHANGED | rc=0 >>
192.168.200.21
192.168.200.24 | CHANGED | rc=0 >>
192.168.200.24