lso.routes.playbook
The API endpoint from which Ansible playbooks can be executed.
- class lso.routes.playbook.PlaybookRunParams(*, playbook_name, callback, inventory, extra_vars={})
Bases:
BaseModel
Parameters for executing an Ansible playbook.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- callback
The address where LSO should call back to upon completion.
- extra_vars
Extra variables that should get passed to the playbook. This includes any required configuration objects from the workflow orchestrator, commit comments, whether this execution should be a dry run, a trouble ticket number, etc. Which extra vars are required solely depends on what inputs the playbook requires.
- inventory
The inventory to run the playbook against. This inventory can also include any host vars, if needed. When including host vars, it should be a dictionary. Can be a simple string containing hostnames when no host vars are needed. In the latter case, multiple hosts should be separated with a
\n
newline character only.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- playbook_name
The filename of a playbook that’s executed. It should be present inside the directory defined in the configuration option
ANSIBLE_PLAYBOOKS_ROOT_DIR
.
- class lso.routes.playbook.PlaybookRunResponse(*, job_id)
Bases:
BaseModel
PlaybookRunResponse domain model schema.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- lso.routes.playbook.run_playbook_endpoint(params)
Launch an Ansible playbook to modify or deploy a subscription instance.
The response will contain either a job ID, or error information.
- Parameters:
params (PlaybookRunParams) – Parameters for executing a playbook.
- Return JSONResponse:
Response from the Ansible runner, including a run ID.