command
Collection: builtin
Full Name: parallax.builtin.command
Aliases: ansible.builtin.command, command
Synopsis
Run a command directly, without a shell
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| cmd | string | yes | The command to run | |
| chdir | string | Change to this directory before running the command | ||
| creates | string | A filename that this command creates. If it exists, the command will not be run | ||
| removes | string | A filename that this command removes. If it does not exist, the command will not be run | ||
| argv | []string | [] | A list of program and arguments to execute, bypassing the shell | |
| executable | string | sh | Path to shell executable to use | |
| stdin | string | String to pass to the command’s stdin | ||
| warn | bool | false | Accepted for compatibility and ignored; removed in ansible-core 2.14. A non-zero exit status always fails the task. |
Example
- name: Rebuild the search index once
command:
cmd: /usr/local/bin/reindex --full
chdir: /srv/app
creates: /srv/app/.reindexed