Repository URL to install this package:
|
Version:
1.0.0b1 ▾
|
doc:
short_help: Create an executable file from a template, execute it, delete it.
examples:
- title: An example 'hello world' ad-hoc script.
desc: |
If stored in a file ``example.frecklet``, this can be executed like so:
```console
frecklecute example.frecklet --name World
```
vars:
script_template: |
#!/usr/bin/env bash
echo "hello {{:: name ::}}!" >> /tmp/hello_world
args:
script_template:
doc:
short_help: The content of the script.
type: string
required: true
cli:
metavar: SCRIPT_CONTENT
become:
doc:
short_help: Whether to use elevated permissions to execute the script.
type: boolean
required: false
default: false
become_user:
doc:
short_help: The user to execute the command as.
type: string
required: false
frecklets:
- task:
become: '{{:: become ::}}'
become_user: '{{:: become_user ::}}'
register: __temp_script_file__
frecklet:
name: tempfile
type: ansible-module
desc:
short: create temporary script file
references:
"'tempfile' Ansible module": https://docs.ansible.com/ansible/latest/modules/tempfile_module.html
properties:
idempotent: false
elevated: '{{:: become ::}}'
internet: false
vars:
prefix: ad_hoc_script_
state: file
- file-with-content:
path: '{{ __temp_script_file__.path }}'
content: '{{:: script_template ::}}'
owner: '{{:: become_user ::}}'
become: '{{:: become ::}}'
- task:
become: '{{:: become ::}}'
become_user: '{{:: become_user ::}}'
frecklet:
name: command
type: ansible-module
desc:
short: execute ad-hoc script
references:
"'command' Ansible module": https://docs.ansible.com/ansible/latest/modules/command_module.html
properties:
idempotent: false
become: '{{:: become ::}}'
vars:
free_form: sh {{ __temp_script_file__.path }}
- path-is-absent:
path: '{{ __temp_script_file__.path }}'
become: '{{:: become ::}}'
meta: {}