内容简介: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
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Java学习笔记
林信良 / 清华大学出版社 / 2015-3-1 / CNY 68.00
●本书是作者多年来教学实践经验的总结,汇集了学员在学习课程或认证考试中遇到的概念、操作、应用等问题及解决方案 ●针对Java SE 8新功能全面改版,无论是章节架构或范例程序代码,都做了重新编写与全面翻新 ●详细介绍了JVM、JRE、Java SE API、JDK与IDE之间的对照关系 ●从Java SE API的源代码分析,了解各种语法在Java SE API中的具体应用 ......一起来看看 《Java学习笔记》 这本书的介绍吧!