shell
Collection: builtin
Full Name: parallax.builtin.shell
Aliases: ansible.builtin.shell, shell
Synopsis
Run a command through the target’s shell, with pipes and redirection
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| cmd | string | yes | The shell 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 |
Example
- name: Write the running config to a dated file
shell:
cmd: nginx -T > /var/backups/nginx-$(date +%F).conf
chdir: /etc/nginx