S
S
Sanes2016-07-16 18:22:34
linux
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)
P
protven, 2016-07-17
@Sanes

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

D
dormin, 2018-03-10
@dormin

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.

P
Puma Thailand, 2016-07-16
@opium

command is enough for everything

D
Dmitry, 2016-07-16
@plin2s

bash module is not in the documentation and I have never seen it used.
All other descriptions can be read on the off site
docs.ansible.com/ansible/command_module.html
docs.ansible.com/ansible/shell_module.html
docs.ansible.com/ansible/raw_module.html

A
Ar0x13, 2016-07-22
@Ar0x13

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