execute-ad-hoc-script

Example:

# An example 'hello world' ad-hoc script.
- execute-ad-hoc-script:
    script_template: |
      #!/usr/bin/env bash

      echo "hello {{:: name ::}}!" >> /tmp/hello_world

Description

n/a

Variables

Name Type Default Description

script_template

string --

The content of the script. Required

become

boolean False

Whether to use elevated permissions to execute the script.

become_user

string --

The user to execute the command as.

Examples

Example 1

An example 'hello world' ad-hoc script.

Code
- execute-ad-hoc-script:
    script_template: |
      #!/usr/bin/env bash

      echo "hello {{:: name ::}}!" >> /tmp/hello_world
Description

If stored in a file example.frecklet, this can be executed like so:

frecklecute example.frecklet --name World

Command-line

frecklecute execute-ad-hoc-script --help

Usage: frecklecute execute-ad-hoc-script [OPTIONS]

  Create an executable file from a template, execute it, delete it.

Options:
  --script-template SCRIPT_CONTENT
                                  The content of the script.  [required]
  --become / --no-become          Whether to use elevated permissions to
                                  execute the script.
  --become-user BECOME_USER       The user to execute the command as.
  --help                          Show this message and exit.