@ -16,12 +16,11 @@ version_added: historical
description :
description :
- The M ( ansible . builtin . command ) module takes the command name followed by a list of space - delimited arguments .
- The M ( ansible . builtin . command ) module takes the command name followed by a list of space - delimited arguments .
- The given command will be executed on all selected nodes .
- The given command will be executed on all selected nodes .
- The command ( s ) will not be
- The command ( s ) will not be processed through the shell , so operations like C ( " * " ) , C ( " < " ) , C ( " > " ) , C ( " | " ) , C ( " ; " ) and C ( " & " ) will not work .
processed through the shell , so variables like C ( $ HOSTNAME ) and operations
Also , environment variables are resolved via Python , not shell , see O ( expand_argument_vars ) and are left unchanged if not matched .
like C ( " * " ) , C ( " < " ) , C ( " > " ) , C ( " | " ) , C ( " ; " ) and C ( " & " ) will not work .
Use the M ( ansible . builtin . shell ) module if you need these features .
Use the M ( ansible . builtin . shell ) module if you need these features .
- To create C ( command ) tasks that are easier to read than the ones using space - delimited
- To create C ( command ) tasks that are easier to read than the ones using space - delimited arguments ,
arguments , pass parameters using the C ( args ) L ( task keyword , https : / / docs . ansible . com / ansible / latest / reference_appendices / playbooks_keywords . html #task)
pass parameters using the C ( args ) L ( task keyword , https : / / docs . ansible . com / ansible / latest / reference_appendices / playbooks_keywords . html #task)
or use O ( cmd ) parameter .
or use O ( cmd ) parameter .
- Either a free form command or O ( cmd ) parameter is required , see the examples .
- Either a free form command or O ( cmd ) parameter is required , see the examples .
- For Windows targets , use the M ( ansible . windows . win_command ) module instead .
- For Windows targets , use the M ( ansible . windows . win_command ) module instead .
@ -42,8 +41,8 @@ attributes:
options :
options :
expand_argument_vars :
expand_argument_vars :
description :
description :
- Expands the arguments that are variables , for example C ( $ HOME ) will be expanded before being passed to the
- Expands the arguments that are variables , for example C ( $ HOME ) will be expanded before being passed to the command to run .
command to run .
- If a variable is not matched , it is left unchanged , unlike shell substitution which would remove it .
- Set to V ( false ) to disable expansion and treat the value as a literal argument .
- Set to V ( false ) to disable expansion and treat the value as a literal argument .
type : bool
type : bool
default : true
default : true