Ansible 维基说:
给定的命令将在所有选定的节点上执行。它不会通过外壳进行处理,所以像$ HOME和操作变量,例如<
,>
,|
,;
和&
不工作(使用shell模块,如果你需要这些功能)。
但是在 Ansible 中它们没有区别:
[oracle@temp ansible]$ ansible temp2 -m shell -a "ls -la $HOME"
temp2 | CHANGED | rc=0 >>
total 40
drwx------. 6 oracle dba 4096 May 16 15:31 .
drwxr-xr-x. 3 root root 20 Mar 18 18:45 ..
drwx------. 3 oracle dba 17 May 16 15:31 .ansible
-rw-------. 1 oracle dba 8100 Apr 17 12:50 .bash_history
-rw-r--r--. 1 oracle dba 18 Aug 24 …
Run Code Online (Sandbox Code Playgroud)