execute-shell

Example:

# Append a string to a file.
- execute-shell:
    command: "echo 'Hello {{:: name ::}}!' >> /tmp/hello.txt"

Description

Execute a single command. The command will be processed through the shell, so it will reckognize environment variables like $HOME, and can be used to do shell operation like "<", ">", etc.

Behind the scenes, this uses the 'shell' Ansible module, so check its documentation for more details.

Resources

Variables

Name Type Default Description

command

string --

The command to execute. Required

become_user

string --

The user to execute this command as.

chdir

string --

The working directory.

environment

dict --

A dictionary of environment variables to add/set.

ignore_error

boolean False

Whether to ignore any potential errors.

no_log

boolean False

Whether to hide the log of this command (because for example the command contains sensitive information).

shell_executable

string --

The (absolute path to the) shell executable to use.

Examples

Example 1

Append a string to a file.

Code
- execute-shell:
    command: "echo 'Hello {{:: name ::}}!' >> /tmp/hello.txt"
Description

You'd execute this like:

frecklecute example.frecklet --name World

Command-line

frecklecute execute-shell --help

Usage: frecklecute execute-shell [OPTIONS]

  Execute a single command. The command will be processed through the shell,
  so it will reckognize environment variables like ``$HOME``,  and can be
  used to do shell operation like "<", ">", etc.

  Behind the scenes, this uses the ['shell' Ansible module](https://docs.ans
  ible.com/ansible/latest/modules/shell_module.html), so check its
  documentation for more details.

Options:
  --command COMMAND               The command to execute.  [required]
  --become-user BECOME_USER       The user to execute this command as.
  --chdir CHDIR                   The working directory.
  --environment ENVIRONMENT       A dictionary of environment variables to
                                  add/set.
  --ignore-error / --no-ignore-error
                                  Whether to ignore any potential errors.
  --no-log / --no-no-log          Whether to hide the log of this command
                                  (because for example the command contains
                                  sensitive information).
  --shell-executable SHELL_EXECUTABLE
                                  The (absolute path to the) shell executable
                                  to use.
  --help                          Show this message and exit.