command

Collection: builtin

Full Name: parallax.builtin.command

Aliases: ansible.builtin.command, command

Synopsis

Run a command directly, without a shell

Parameters

NameTypeRequiredDefaultDescription
cmdstringyesThe command to run
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
executablestringshPath to shell executable to use
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

- name: Rebuild the search index once
  command:
    cmd: /usr/local/bin/reindex --full
    chdir: /srv/app
    creates: /srv/app/.reindexed