内容简介: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.
因此在使用的时候需要注意了。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
如何不在网上虚度人生
[美] 肯尼思·戈德史密斯 / 刘畅 / 北京联合出版公司 / 2017-9 / 39.80元
我们平时上网多大程度上是浪费时间,多大程度是在学习、关心社会、激发创造力?我们真能彻底断网,逃离社交网络吗? 手机把都市人变成一群电子僵尸,是福是祸? 浏览记录就是我们将来的回忆录吗?文件归档属于一种现代民间艺术? 不自拍、P图、发朋友圈,我还是我吗? 美国知名概念艺术家戈德史密斯认为:上网绝不是浪费时间,而是一种创造性的活动。在本书中他以跨学科角度、散文式语言进行论证,涉及大众传播学、计算......一起来看看 《如何不在网上虚度人生》 这本书的介绍吧!