内容简介:ansible 的 command 和 shell 模块都可以执行命令,例如:但是如果你使用 command 运行一些包含特殊符号的命令,比如“|” “<” “>” 之类的命令就无法执行,原因我们通过查看
ansible 的 command 和 shell 模块都可以执行命令,例如:
➜ www ansible k8s-master -m command -a 'pwd' kubernetes-1 | SUCCESS | rc=0 >> /root ➜ www ansible k8s-master -m shell -a 'pwd' kubernetes-1 | SUCCESS | rc=0 >> /root
但是如果你使用 command 运行一些包含特殊符号的命令,比如“|” “<” “>” 之类的命令就无法执行,原因我们通过
ansible-doc command
查看
Notes:
* If you want to run a command through the shell (say you are using `<', `>', `|', etc), you actually want the [shell]
module instead. The `command' module is much more secure as it's not affected by the user's environment.
* `creates', `removes', and `chdir' can be specified after the command. For instance, if you only want to run a
command if a certain file does not exist, use this.
因此在使用的时候需要注意了。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- Node.js模块系统 (创建模块与加载模块)
- 黑客基础,Metasploit模块简介,渗透攻击模块、攻击载荷模块
- 022.Python模块序列化模块(json,pickle)和math模块
- 024.Python模块OS模块
- 023.Python的随机模块和时间模块
- Laravel 模块化开发模块 – Caffienate
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
你必须知道的495个C语言问题
Steve Summit / 孙云、朱群英 / 人民邮电出版社 / 2009-2 / 45.00元
“本书是Summit以及C FAQ在线列表的许多参与者多年心血的结晶,是C语言界最为珍贵的财富之一。我向所有C语言程序员推荐本书。” ——Francis Glassborow,著名C/C++专家,ACCU(C/C++用户协会)前主席 “本书清晰阐明了Kernighan与Ritchie《The C programming Language》一书中许多简略的地方,而且精彩地总结了C语言编程......一起来看看 《你必须知道的495个C语言问题》 这本书的介绍吧!
RGB转16进制工具
RGB HEX 互转工具
图片转BASE64编码
在线图片转Base64编码工具