Trevor
Starfighter Starfighter
Starfighter
  • 352 Views

Ansible shell module

Hello all,

Got a question about the "shell" module, when used in a playbook.

Primary what I'm seeking is an explanation of the "cmd" parameter when used with
the "shell" module.    ansible-doc  shell ain't giving me very much to sink my teeth 
into.


What do I get when using the "cmd" parameter, that I don't get without using it.  
For example:

shell:  touch  file1

            versus

shell:
    cmd:  touch file1

 

I used both formats in a playbook, and the results were the same.  

Thanks in advance.  Hope you're safe and well!!!

 

 

Trevor "Red Hat Evangelist" Chandler
Labels (2)
0 Kudos
2 Replies
EmanuelHaine
Flight Engineer
Flight Engineer
  • 174 Views

Hello @Trevor ,

I believe it is just a matter of syntax.


If you take a look in the documentation "ansible-doc shell" you can see it works both ways: "The `shell' module takes the command name followed by a list of space-delimited arguments. Either a free form command or `cmd' parameter is required,". Furthermore, according to the documentation, there is no mandatory option, which means you can use the module without giving any option.

Trevor
Starfighter Starfighter
Starfighter
  • 168 Views

Hello9 Emanuel,

Thank you very much for your input.

Hope you're safe and well!!!

Trevor

 

 

 

Trevor "Red Hat Evangelist" Chandler
0 Kudos
Join the discussion
You must log in to join this conversation.