Sanes2016-07-16 18:22:34
Sanes, 2016-07-16 18:22:34

Ansible. How are raw/command/shell different?

Could you explain on your fingers the difference between raw / command / shell and in what cases it is better to use it?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
protven, 2016-07-17

The most important (in my opinion) difference between the raw module and command and shell is that raw does not require python on servers. Well, except of course the server from which you launch playbooks. I was just using raw to solve the problem of installing python 2.7 on Solaris. Sobsno the problem of "bootstrapping" - how to use a butt that needs a python to install a python xD

dormin, 2018-03-10

raw differs from command and shell in that it doesn't do any extra processing of command execution. These additional processing are present in almost every Ansible module. The raw module sends the command as it is in its "raw" form without checks.
The command and shell modules differ in that in the command module, the command is executed without going through the /bin/sh shell. Therefore, variables defined in the shell and redirect pipelines will not work. The shell module executes commands through the default shell /bin/sh. Therefore, shell variables and redirects will be available there.

Puma Thailand, 2016-07-16

command is enough for everything

Dmitry, 2016-07-16

bash module is not in the documentation and I have never seen it used.
All other descriptions can be read on the off site

Ar0x13, 2016-07-22

command if I'm not mistaken does not understand pipe ( | ) , so when you need to use it = use shell. About raw I will not prompt.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question