runspec-playbook
Run Ansible playbooks locally on a host the runspec-console is already connected to — no second SSH stack, one host list. The playbook comes from a git repo in the console's Repos tab (sent with each run) or is bundled in this package.
runspec-console ──SSH──▶ host ──▶ run-playbook ──▶ ansible-runner (connection: local) ──▶ your playbook
(runspec_hosts.toml) (acts on localhost — no SSH)
This is the ansible-pull pattern, driven by the console instead of cron. The
console reaches each host over its own SSH connection and runs run-playbook
there; Ansible then executes the playbook against localhost, so it opens no
SSH of its own. Everything the console already owns per host keeps applying —
connection, credentials, denylist, audit — while Ansible supplies the playbook
richness (idempotent modules, handlers, templates, become:, --check).
When this fits: your playbooks are per-host (provisioning/config of the box they run on). Local execution means each host only knows about itself, so anything that coordinates across hosts —
delegate_to,run_once, reading another host'shostvars,serial:rolling deploys — needs a real Ansible control node and is out of scope here.
Playbooks from a git repo (console 0.389.0+)
Keep your playbooks in a git repo (a private GitHub repo is fine — no internal GitLab or package index needed), register it in the console's Settings → Repos and Sync it. Then:
run-playbook --repo homelab --playbook site.yml --check # dry run
run-playbook --repo homelab --playbook web/patch.yml
The console packs the repo's checkout (no .git, .gitignored files left out)
and sends it with the run on stdin, after the env frame that already carries
credentials. Nothing is copied to the host beforehand and nothing is left
behind; run_as / sudo need nothing extra. The repo is checked against a
content hash, and the JSON result reports the repo, commit and whether the
checkout had uncommitted edits (dirty).
- Inventory. The one host is named as the console names it, and sits in its
console group and profiles — so
hosts: web,group_vars/web.ymlandhost_vars/web-01.ymlin your repo work as they would with a real inventory. - What gets sent. Runs you start (Forms, chat, a saved run, an MCP client)
send the checkout as it is, uncommitted edits included — so the agent can
write a playbook with the console's repo tools and
--checkit. Schedules and triggers send the committed tree only. - Limits. Up to 5,000 files / 32 MB per repo. Keep big binaries out of the playbook repo; copy them with a saved transfer.
- Fan out. Target a host group or profile (a saved run, a schedule, the agent) and every host runs the same playbook locally.
--repo carries meta = { console = "playbook-repo" }, which is how the
console knows to send the repo and to offer the Repos-tab names as choices. Run
by hand on the host (no console), --repo is refused; bundled playbooks still work.
Deployment is the worked example, not the limit. The mechanism runs any
per-host playbook — patching, config enforcement, an audit/report pass, a
restart — and the shipped run-playbook runnable is just the deploy-shaped one
(package + version). Add a patch.yml / audit.yml under playbooks/ and a
matching runnable (or a generic playbook-name + extra-vars runnable) the same
way; see "Making it your own" below.
The runnable
| Arg | Description | |
|---|---|---|
package |
positional 1, optional | Package to deploy (the bundled deploy playbook needs it); supports extras, e.g. myapp or myapp[postgres,redis]. |
version |
positional 2, optional | Exact version; composed into <package>==<version>. |
--repo |
str | A repo from the console's Repos tab; the console sends it with the run. |
--playbook |
str | A path inside --repo (e.g. site.yml), or without --repo a bundled playbook (default deploy). |
--check / -C |
flag | Dry run — Ansible check mode (report, don't apply). |
--extra-var k=v |
repeatable | Extra Ansible variables, merged after the deploy_* vars. |
--tags / --skip-tags |
str | Comma-separated Ansible tag filters. |
--verbosity / -v |
int 0–4 | Ansible verbosity. |
run-playbook myapp 1.4.2
run-playbook 'myapp[postgres]' 1.4.2 --check
run-playbook myapp 1.4.2 --extra-var venv_path=/opt/myapp/venv -v
Given a package, the runnable passes these variables to the playbook:
deploy_package, deploy_version, deploy_package_spec. It returns JSON
(status, rc, changed, stats, plus repo/commit/dirty for a repo
playbook) — and follows the Ansible changed
convention so it reads cleanly in the console history/analytics.
Secrets
Do not package a .env of secrets. A wheel/sdist on your index is readable
by anyone with read access, package data is not encrypted, and it would land on
every host's disk in site-packages. Bake only non-secret config (an index
host, a default venv path) into a playbook variable.
Instead use the console's existing Credentials → env var channel. Secrets
live in the OS keychain (Windows Credential Manager / macOS Keychain / Secret
Service); only metadata is stored on disk. At run time the console injects them
as plain environment variables derived from the credential's label + kind, and
this runnable forwards the environment to the playbook. Read them in tasks with
lookup('env', 'NAME').
Name the credential so the convention yields the names your playbook expects:
| Credential label | Kind | Env vars injected |
|---|---|---|
Nexus |
token | NEXUS_TOKEN, NEXUS_PAT |
Nexus |
userpass | NEXUS_USERNAME, NEXUS_USER, NEXUS_PASSWORD |
Deploy Key |
token | DEPLOY_KEY_TOKEN, DEPLOY_KEY_PAT |
Select one or more credentials in the run dialog (the Forms tab) — these are
the GitLab CI/CD variables you have today, now sourced from the keychain instead
of a CI settings page. For an unattended run, a schedule with
action = "runnable" runs run-playbook with no operator present (scheduling
is the authorization); in-scope credentials auto-apply on the agent path.
A file-based secret is only acceptable if it is Ansible Vault (encrypted) — and the vault password itself should still arrive via an injected env var (e.g.
ANSIBLE_VAULT_PASSWORD_FILEpointing at a tiny script that echoes it), not be packaged.
Making it your own
This package is a reference. To adopt it:
- Replace
runspec_playbook/playbooks/deploy.ymlwith your existing per-host playbooks (keephosts: all— the inventory islocalhost). Vendor any required collections under acollections/dir for an index-only / air-gapped install rather than fetching from Galaxy at run time. - Rename the package and publish it to your internal index from your existing GitLab CI — CI keeps building and publishing; the console just deploys.
- Install it (and
ansible-core) into the same venv as runspec on each host (e.g. from the console's Marketplace tab), sorun-playbooksurfaces in the console alongside your other runnables.
See docs/design/console-ansible-deploy.md for the full design and rationale.
Requirements
runspec, ansible-core, and ansible-runner on the host. Zero of these need
to be reachable at run time once installed.
Metadata
Release files for runspec-playbook 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| runspec_playbook-0.2.0.tar.gz | 15.6 kB | With provenance | Details for runspec_playbook-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| runspec_playbook-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for runspec_playbook-0.2.0-py3-none-any.whl |
Total release size: 30.7 kB
Release files / runspec_playbook-0.2.0.tar.gz
| Download URL | runspec_playbook-0.2.0.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
021cf0a4d2d16aded1811c64cfb9c7aed76c340139a34bf045d91834519d1e8f
|
|
BLAKE2b-256 checksum How to use checksums |
b988c72817088d4d3690a20060b050b94b210240c700e8d5611eaf44ebf809b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / runspec_playbook-0.2.0-py3-none-any.whl
| Download URL | runspec_playbook-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a37910431fbab0d9189067aff4960386c542968ad1e9eeb6a44169bfe5728089
|
|
BLAKE2b-256 checksum How to use checksums |
6546a1d989b29552c2439e5d153402999f9ab15abcdfb650ac6cb9df9608ad63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logSecurity for runspec-playbook 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for runspec_playbook-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.