Shell Module ansible localhost -m shell -a "uptime > uptime. The stream operator, when passed through the shell and command module, will show different results, as the command module doesn’t recognize the stream operators and will throw errors, whereas the same will work fine with the shell module.Ĭommand Module, will throw an error as it will not recognize > stream operator ansible localhost -m command -a "uptime > uptime.txt" The command module is more secured, compared to the shell moduleįor example, both shell and command module will have the same outputs, ansible localhost -m shell -a "uptime" ansible localhost -m command -a "uptime" Stream operators like, &, and | will not work with command modules. this is more of an ansible way to execute the Linux find command with some. The command module will not recognize certain variables like $HOME For the first cited issue, yaml doesnt behave like python or shell which. The command module will execute the commands without proceeding to through the shell. The command module is the default module to execute the binary commands, if we do not specify the module name in our ad-hoc command, ansible will by default use the command module. The Shell Module as well as command modules are used to execute Binary Commands.
0 Comments
Leave a Reply. |