Skip to content

docs: how a playbook gets a secret (Key Store keys are not passed) - #185

Closed
xamfx0 wants to merge 1 commit into
semaphoreui:mainfrom
xamfx0:docs/2117-secrets-in-playbooks
Closed

xamfx0 wants to merge 1 commit into
semaphoreui:mainfrom
xamfx0:docs/2117-secrets-in-playbooks

Conversation

@xamfx0

@xamfx0 xamfx0 commented Nov 5, 2026

Copy link
Copy Markdown

Answers semaphoreui/semaphore#2117 ("How do I access Key Store keys in a playbook?").

Key Store keys are never passed to a playbook. Semaphore uses them itself (repository access, inventory SSH/become credentials, vault password prompt), so lookup('env', ...) on a key name is empty. The docs didn't say this anywhere.

  • Key Store page: new "Secrets in playbooks" section — keys aren't exposed (except the inventory SSH key, indirectly through SSH_AUTH_SOCK); use Variable Group secrets instead, with an example for both the extra-variable and the environment-variable type; no_log: true since task output isn't filtered; base64 or ansible-vault for files like private keys; a "Since v2.20" note: before 2.20 extra-variable secrets go on the command line as --extra-vars name=value, show up in the process list and are cut at the first space.
  • Variable Groups page: short "Secrets" section linking to the above.

Checked against the code on develop and the release tags (Variable Group var/env secrets exist since 2.12; the vault-encrypted extra-vars file is only in 2.20 pre-releases).

The same two sections are added in all 10 locales to keep the structure check happy. I translated them myself, so a native speaker's review would be welcome.

Build: npm run build passes for all locales. scripts/check-docs.mjs reports 10 problems in admin-guide/authentication/local, which are there on main as well.

…ssed)

Key Store: a "Secrets in playbooks" section. Keys are consumed by
Semaphore itself (repository, inventory SSH/become, vault password) and
never become an Ansible variable or a task environment variable, so
lookup('env', ...) on a key name is empty; only the inventory SSH key is
usable indirectly through SSH_AUTH_SOCK. The way to hand a value to a
playbook is a Variable Group secret: Extra variables become Ansible
extra vars, Environment variables become process env vars. Includes a
playbook example for both, the no_log practice (task output is not
filtered), base64 or ansible-vault for files such as SSH private keys,
and a "Since v2.20" note: before 2.20 extra-var secrets go on the
command line as --extra-vars name=value and are cut at the first space.

Variable Groups: a short Secrets section with the two lists, linking to
the Key Store section. Same change in all 10 locales.

Refs semaphoreui/semaphore#2117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant