PARALLAX

command

Run a command directly, without a shell

Collection: builtin

Full Name: parallax.builtin.command

Aliases: ansible.builtin.command, command

Synopsis

Run a command directly, without a shell

Parameters

NameTypeRequiredDefaultDescription
cmdstringThe command to run; mutually exclusive with argv
chdirstringChange to this directory before running the command
createsstringA filename that this command creates. If it exists, the command will not be run
removesstringA 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
executablestringAccepted for legacy compatibility and ignored; use shell for shell execution
stdinstringString to pass to the command’s stdin
warnboolfalseAccepted for compatibility and ignored; removed in ansible-core 2.14. A non-zero exit status always fails the task.

Example

yaml
- name: Rebuild the search index once
  command:
    cmd: /usr/local/bin/reindex --full
    chdir: /srv/app
    creates: /srv/app/.reindexed
Search
    ↑ ↓ move↵ openesc close