[esb@esbapp1 sbin]$ ./ansible -i esbhosts esbgroup -m shell -a "echo $HOSTNAME"
10.2.229.105 | SUCCESS | rc=0 >>
esbapp1
10.2.229.103 | SUCCESS | rc=0 >>
esbapp1
10.2.229.104 | SUCCESS | rc=0 >>
esbapp1
10.2.229.102 | SUCCESS | rc=0 >>
esbapp1
10.2.229.101 | SUCCESS | rc=0 >>
esbapp1
10.2.229.106 | SUCCESS | rc=0 >>
esbapp1
[esb@esbapp1 sbin]$ ./ansible -i esbhosts esbgroup -m shell -a 'echo $HOSTNAME'
10.2.229.105 | SUCCESS | rc=0 >>
esbapp5
10.2.229.102 | SUCCESS | rc=0 >>
esbapp2
10.2.229.104 | SUCCESS | rc=0 >>
esbapp4
10.2.229.103 | SUCCESS | rc=0 >>
esbapp3
10.2.229.101 | SUCCESS | rc=0 >>
esbapp1
10.2.229.106 | SUCCESS | rc=0 >>
esbapp6
[esb@esbapp1 sbin]$
ansible -m shell -a 注意单引号和双引号
猜你喜欢
转载自blog.csdn.net/zhaoyangjian724/article/details/82107257
今日推荐
周排行