mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 23:21:22 -07:00
shell: Improve documentation (#51109)
* shell: Improve documentation This PR includes: - Adding parameter types - General improvements * Update lib/ansible/modules/commands/shell.py
This commit is contained in:
parent
20936bbc3d
commit
6c6b088bde
1 changed files with 21 additions and 15 deletions
|
@ -34,53 +34,59 @@ options:
|
||||||
- There is no actual parameter named 'free form'.
|
- There is no actual parameter named 'free form'.
|
||||||
- See the examples on how to use this module.
|
- See the examples on how to use this module.
|
||||||
required: yes
|
required: yes
|
||||||
|
type: str
|
||||||
creates:
|
creates:
|
||||||
description:
|
description:
|
||||||
- A filename, when it already exists, this step will B(not) be run.
|
- A filename, when it already exists, this step will B(not) be run.
|
||||||
|
type: path
|
||||||
removes:
|
removes:
|
||||||
description:
|
description:
|
||||||
- A filename, when it does not exist, this step will B(not) be run.
|
- A filename, when it does not exist, this step will B(not) be run.
|
||||||
|
type: path
|
||||||
version_added: "0.8"
|
version_added: "0.8"
|
||||||
chdir:
|
chdir:
|
||||||
description:
|
description:
|
||||||
- Change into this directory before running the command.
|
- Change into this directory before running the command.
|
||||||
|
type: path
|
||||||
version_added: "0.6"
|
version_added: "0.6"
|
||||||
executable:
|
executable:
|
||||||
description:
|
description:
|
||||||
- Change the shell used to execute the command.
|
- Change the shell used to execute the command.
|
||||||
- This expects an absolute path to the executable.
|
- This expects an absolute path to the executable.
|
||||||
|
type: path
|
||||||
version_added: "0.9"
|
version_added: "0.9"
|
||||||
warn:
|
warn:
|
||||||
description:
|
description:
|
||||||
- Enable or disable task warnings.
|
- Whether to enable task warnings.
|
||||||
type: bool
|
type: bool
|
||||||
default: yes
|
default: yes
|
||||||
version_added: "1.8"
|
version_added: "1.8"
|
||||||
stdin:
|
stdin:
|
||||||
description:
|
description:
|
||||||
- Set the stdin of the command directly to the specified value.
|
- Set the stdin of the command directly to the specified value.
|
||||||
|
type: str
|
||||||
version_added: "2.4"
|
version_added: "2.4"
|
||||||
stdin_add_newline:
|
stdin_add_newline:
|
||||||
|
description:
|
||||||
|
- Whether to append a newline to stdin data.
|
||||||
type: bool
|
type: bool
|
||||||
default: yes
|
default: yes
|
||||||
description:
|
|
||||||
- If set to C(yes), append a newline to stdin data.
|
|
||||||
version_added: "2.8"
|
version_added: "2.8"
|
||||||
notes:
|
notes:
|
||||||
- If you want to execute a command securely and predictably, it may be
|
- If you want to execute a command securely and predictably, it may be
|
||||||
better to use the M(command) module instead. Best practices when writing
|
better to use the M(command) module instead. Best practices when writing
|
||||||
playbooks will follow the trend of using M(command) unless the C(shell)
|
playbooks will follow the trend of using M(command) unless the C(shell)
|
||||||
module is explicitly required. When running ad-hoc commands, use your best
|
module is explicitly required. When running ad-hoc commands, use your best
|
||||||
judgement.
|
judgement.
|
||||||
- Check mode is supported when passing C(creates) or C(removes). If running
|
- Check mode is supported when passing C(creates) or C(removes). If running
|
||||||
in check mode and either of these are specified, the module will check for
|
in check mode and either of these are specified, the module will check for
|
||||||
the existence of the file and report the correct changed status. If these
|
the existence of the file and report the correct changed status. If these
|
||||||
are not supplied, the task will be skipped.
|
are not supplied, the task will be skipped.
|
||||||
- To sanitize any variables passed to the shell module, you should use
|
- To sanitize any variables passed to the shell module, you should use
|
||||||
"{{ var | quote }}" instead of just "{{ var }}" to make sure they don't include evil things like semicolons.
|
C({{ var | quote }}) instead of just C({{ var }}) to make sure they
|
||||||
|
do not include evil things like semicolons.
|
||||||
- An alternative to using inline shell scripts with this module is to use
|
- An alternative to using inline shell scripts with this module is to use
|
||||||
the M(script) module possibly together with the M(template) module.
|
the M(script) module possibly together with the M(template) module.
|
||||||
- For Windows targets, use the M(win_shell) module instead.
|
|
||||||
seealso:
|
seealso:
|
||||||
- module: command
|
- module: command
|
||||||
- module: raw
|
- module: raw
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue