LSO, an API for remotely running Ansible playbooks.
Project description
LSO: an API that allows for remotely executing Ansible playbooks.
Code documentation
Code documentation can be found at https://workfloworchestrator.org/lso
Quick start
This is a quick setup guide for running on your local machine.
As a Docker container
To run LSO as a Docker container, build an image using the Dockerfile.example
as an example. Be sure to update
requirements.txt
and ansible-galaxy-requirements.yaml
accordingly, depending on your specific Ansible collection and
-role needs.
Use the Docker image to then spin up an environment. An example Docker compose file is presented below:
services:
lso:
image: my-lso:latest
env_file:
.env # Load default environment variables from the .env file
volumes:
- "/home/user/ansible_inventory:/opt/ansible_inventory:ro"
- "~/.ssh/id_ed25519.pub:/root/.ssh/id_ed25519.pub:ro"
- "~/.ssh/id_ed25519:/root/.ssh/id_ed25519:ro"
This will expose the API on port 8000. The container requires some more files to be mounted:
- An .env file: Sets default environment variables, like ANSIBLE_PLAYBOOKS_ROOT_DIR for the location of Ansible playbooks inside the container.
- Environment variables: Specific configurations, such as ANSIBLE_ROLES_PATH, can be directly set in the environment section. This is ideal for values you may want to override without modifying the .env file.
- An Ansible inventory for all host and group variables that are used in the playbooks
- A public/private key pair for SSH authentication on external machines that are targeted by Ansible playbooks.
- Any Ansible-specific configuration (such as
collections_path
,roles_path
, etc.) should be set using environment variables.ANSIBLE_ROLES_PATH
is given as an example in the Docker compose snippet above.
Install the module
As an alternative, below are a set of instructions for installing and running LSO directly on a machine.
One of these should be what you're looking for:
- Install the latest release
python3 -m venv my-venv-directory
. my-venv-directory/bin/activate
pip install orchestrator-lso
- Install the source code
git clone https://github.com/workfloworchestrator/lso.git && cd lso
python3 -m venv my-venv-directory
. my-venv-directory/bin/activate
pip install flit
flit install --deps production
# Or, for the full development environment
flit install --deps develop
Running the app
- Set required environment variables; see
env.example
for reference. - If necessary, set the environment variable
ANSIBLE_HOME
to a custom path. - Run the app like this (
app.py
starts the server on port 44444):
source .env && python -m lso.app
Task Execution Options
- Celery (Distributed Execution)
- For distributed task execution, set
EXECUTOR=celery
. - Add Celery config in your environment variables:
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0
WORKER_QUEUE_NAME=lso-worker-queue # default value is None so you don't need this by default.
- Start a Celery worker:
celery -A lso.worker worker --loglevel=info -Q lso-worker-queue
- ThreadPoolExecutor (Local Execution)
For local concurrent tasks, set EXECUTOR=threadpool
and configure MAX_THREAD_POOL_WORKERS
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file orchestrator_lso-2.0.0.tar.gz
.
File metadata
- Download URL: orchestrator_lso-2.0.0.tar.gz
- Upload date:
- Size: 298.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25299e321f575e68f4bd0e598882a64833114830cb18bfe847381118738b18bb |
|
MD5 | 7663e609019bb47ee3b6459555eb1432 |
|
BLAKE2b-256 | a8b292160f9d924c94e698083a4d6bc9f3718af31f405cb35527d3057b82da5d |
File details
Details for the file orchestrator_lso-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: orchestrator_lso-2.0.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7ebf1c081f99394db3533d144373cf66d1fa261d1a78a1efdc5adb383f1bf89 |
|
MD5 | 660b6394e16ca16248642851aa703f47 |
|
BLAKE2b-256 | 9c5a027698cd12beff209eb4fcb8fe733abacf682d0e81535716f83dd58e432e |