create executable-object
Create a new Executable Object resource
Synopsis
Create
This command will create an executable-object resource in torero's data store. This executable object resource will reference an executable file that exists on the machine where torero is running services.
This executable object resource can then be paired with a service to specify how it is run. The following behavior is overridden for the different service types.
- Python -- Path to Python interpreter on disk
- Ansible -- Path to Python interpreter Ansible runs under on disk
- OpenTofu -- Path to OpenTofu executable on disk
- Executable -- Path to any executable file. E.g.
/bin/bash
Executable Object Usage Pattern
The following example demonstrates how an executable object can be used in conjunction with a Python service.
- Create Executable Object
Let's say we have a specific Python interpreter that we want to use when executing a Python
service. The python interpreter exists at
/usr/bin/python3.12instead of the Python interpreter that lives in your$PATHat/usr/bin/python3.9. We would create an executable object that points to our interpreter.
>_ torero create executable-object py-312 \
--exec-command /usr/bin/python3.12
- Create Service Referencing Executable Object
You can now reference the new executable object resource that you made when running Python,
Ansible, OpenTofu or regular Executable Services via the --executable-object flag.
>_ torero create service python-script my-script \
--executable-object py-312 \
--repository my-repo
- Run The Service
Run the service that you had created with and observe that executable you specified is being used in the DEBUG level logs.
>_ torero run service python-script my-script --verbose
...
DBG validating that executable exists at '/usr/bin/python3.12'
DBG running command '/usr/bin/python3.12 --version'
torero create executable-object <name> [flags]
Examples
Create An Executable Object Linking To Bash
Creates an executable object that can be utilized with the executable service.
See torero create service executable --help for more information
>_ torero create executable-object bash \
--exec-command /bin/bash
Create An Executable Object Linking To A Python Interpreter
Create an executable object that links to a specific Python interpreter that can then be used in conjunction with Python and Ansible services.
>_ torero create executable-object py312 \
--exec-command /usr/bin/python3.12
Options
--description string A brief description of the service
--exec-command string The command to be used to execute resource. Typically the path to an executable
on the torero execution instance
-h, --help help for executable-object
--tag stringArray Metadata tag(s) to associate with the service
Options inherited from parent commands
--config string Specify the path to the configuration file
--raw Displays the result of the command in its raw format
--verbose Enable verbose output
SEE ALSO
- torero create - Create a resource