> ## Documentation Index
> Fetch the complete documentation index at: https://docs.axottle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bash, Ansible, files and variables

> Script playbooks: formats, dependencies, input files, environments, limitations, and practical examples.

Script step allows you to perform your own work on the nodes: application diagnostics, deployment, environment preparation or maintenance. Telepúrte saves the script in the catalog, fixes it in the playbook version and shows the result separately for each node.

## Formats and environment

\| Format | How to execute | What is required on the | node
\|---|---|---|
\| `.sh` | Bash script | `/bin/bash` and used commands |
\| `.yml`, `.yaml` | Ansible playbook with local connection to `localhost` | `ansible-playbook`, necessary collections and dependencies |

Ansible runs locally on each selected node. The list of servers is set in Telepúrte; do not transfer an external SSH inventory to such a file for a separate Ansible control server.

The script works in the context of the agent and its system constraints. Check the process user and available rights: the choice of script in the panel does not automatically give root or sudo. The imported node requires a compatible version of Axottle Agent with support for scripts.

## Add material

In **Playbooks and Schedules** add the script to the directory: upload the file or paste the text. The name should use Latin, numbers, dot, hyphen or underline and a suitable extension. Script - UTF-8 without zero characters.

Then create or open a new version of the playbook, add the action **Run the script** and select it. If necessary, attach regular files and a set of environments.

One directory file is limited to 1 MiB. Input files at a step can be up to eight; the total volume of the script and its input files is limited to 2 MiB. The names of the input files must be unique within the launch.

## Bash example without changing the server

Save as `inspect.sh`:

```bash theme={null}
#!/usr/bin/env bash
set -euo pipefail

printf 'Environment: %s\n' "${DEPLOY_ENV:-test}"
/usr/bin/uptime
if [[ -f "$TELEPURTE_FILES_DIR/app.conf" ]]; then
  sha256sum "$TELEPURTE_FILES_DIR/app.conf"
fi
```

Add a regular `app.conf` file and a set of variables with `DEPLOY_ENV=test`. Attach them to a step and execute them on one node. The script prints the environment tag, uptime and checksum of the transferred file. It does not install `app.conf` in `/etc`: such placement should be explicitly written in the script or made a typed action.

The input files are located in the directory that `TELEPURTE_FILES_DIR` sets the path to. The work directory is temporary; do not rely on files from the previous execution. After completion, temporary materials are deleted.

## Example of Ansible

Save `inspect.yml`:

```yaml theme={null}
- name: Inspect the current node
  hosts: all
  connection: local
  gather_facts: false
  tasks:
    - name: Read uptime
      ansible.builtin.command: /usr/bin/uptime
      changed_when: false
```

`ansible-playbook` must be installed on each selected machine. If not, the result will be `ansible_unavailable`; Telepúrte does not install Ansible automatically during this step. Collections, utilities and rights for the more complex playbook also prepare in advance.

## Environment variables

Create a named set and add name/value pairs. Names must be unique; up to 64 variables and up to 32 KiB of the set are supported; System names affecting the launch of the interpreter and the `LD_` prefix are prohibited. Do not replace `PATH`, `BASH_ENV` or `TELEPURTE_FILES_DIR`.

Values are transmitted directly to the process environment; `.env` is not created on the server. If the application is waiting for a file, add it separately or explicitly create it in a script with the right permissions.

Materials are stored encrypted. In the output, it hides the matching values of the environment, but this is not protection against all ways of inferring a secret: the converted, broken or encrypted value may not match. Do not turn on `set -x` and do not print the entire environment in secret scenarios.

## Time and result

Script execution is limited to 15 minutes. The result includes the completion code, the error code, and a limited combined stdout/stderr. The saved output can be clipped; the interface shows the corresponding feature; Keep a long full log where your application intended it, and don't count the short Telepúrte result as a full deployment log.

| Error | What to check for | |
| - | - | - |
| `ansible_unavailable` | Ansible Installation and binary availability to | agent |
| `script_failed` | Complete code, dependencies, parameters and output | |
| `timeout` | Step duration and hanging; actual state before repeating | |
| Agent does not support | scripts Version and state of the agent on a specific | node |
| `execution_uncertain` | Was completed before | was confirmed |

A normal run from the interface does not include an automatic canary. Choose the test node first; a phased rollout with an error threshold is described in the [tasks](https://docs.axottle.com/en/telepurte/jobs.md).

## Verification

Check the completion code and output on the test node, then the expected result with an independent command or application query. For modifying scripts, allow for re-run without damaging the already prepared state.

## Rollback

Stop the unissued activity in the task. This does not cancel the script that has already been executed. Return configurations, versions and data with a separate script; before repeating after a timeout, first check what has already changed.

Automation capabilities depend on the agent’s version and local policies.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.