Executable Object
An executable object is a resource in torero that references an executable file on the machine where torero services are running. Executable objects are used to specify which binary or interpreter should be used when executing various types of services.
Overview
Executable objects serve as a way to standardize and manage the executables used across different services. Instead of hardcoding paths to executables in each service, you create an executable object once and reference it in multiple services.
Use Cases
Executable objects can be used with the following service types:
- Python Services - Specify a particular Python interpreter (e.g.,
/usr/bin/python3.12) - Ansible Services - Specify which Python interpreter Ansible should run under
- OpenTofu Services - Specify the path to the OpenTofu executable
- Executable Services - Specify any executable file (e.g.,
/bin/bash, custom binaries)
This is particularly useful when you have: - Multiple Python versions installed and need to use a specific one - Custom-built executables that aren't in your system PATH - Specific versions of tools that need to be used consistently across services
Create
The torero create executable-object command creates an executable object resource. The command requires a name and the path to the executable on disk.
Creating an Executable Object for Bash
The most common use case is creating an executable object that points to a shell interpreter for use with executable services.
>_ torero create executable-object bash --exec-command /bin/bash
This creates an executable object named bash that points to /bin/bash on the system.
Creating an Executable Object for a Specific Python Version
If you have multiple Python versions installed and want to ensure a service uses a specific version:
>_ torero create executable-object py312 --exec-command /usr/bin/python3.12 --description "Python 3.12 interpreter"
Adding Metadata
Executable objects support optional metadata through the --description and --tag flags:
>_ torero create executable-object custom-binary \
--exec-command /opt/myapp/bin/processor \
--description "Custom data processor v2.1" \
--tag production \
--tag data-processing
Verify Creation
You can view all executable objects using the torero get executable-objects command:
>_ torero get executable-objects
Output:
NAME EXEC COMMAND DESCRIPTION TAGS
bash /bin/bash
py312 /usr/bin/python3.12 Python 3.12 interpreter
custom-binary /opt/myapp/bin/processor Custom data processor v2.1 production, data-processing
To view details about a specific executable object, use the torero describe executable-object command:
>_ torero describe executable-object py312
Output:
Name: py312
Exec Command: /usr/bin/python3.12
Description: Python 3.12 interpreter
Tags:
Using Executable Objects
Once created, executable objects can be referenced when creating services using the --executable-object flag.
With Python Services
>_ torero create service python-script my-script \
--repository my-repo \
--filename main.py \
--executable-object py312
With Ansible Services
>_ torero create service ansible-playbook my-playbook \
--repository my-repo \
--playbook site.yml \
--executable-object py312
With Executable Services
>_ torero create service executable backup-script \
--repository scripts-repo \
--filename backup.sh \
--executable-object bash
Validation
When a service using an executable object is run, torero will validate that the executable exists at the specified path. If the executable is not found, the service will fail with an error message indicating the missing executable.
This validation happens at runtime, not at creation time, which allows you to create executable objects and services even if the executable is not yet present on all execution nodes.
Delete
To delete an executable object, use the torero delete executable-object command:
>_ torero delete executable-object bash
Note: You cannot delete an executable object that is currently being used by one or more services. You must delete or update those services first.