fix(semaphore/configure): vault key attaches via vaults[] not vault_key_id

Semaphore v2.18 replaced the single vault_key_id field with a vaults[]
array supporting multi-vault per template. Sending vault_key_id is
silently ignored — template stores no vault association, runs fail
at the playbook stage with 'Attempting to decrypt but no vault
secrets found'.

Wrap the single configured vault password in the required envelope:
  vaults: [{id: 0, vault_key_id: <key_id>, name: 'default'}]

Empirically verified: PUT with this shape returns 204 and the GET
echoes the vault back with a server-assigned id.
This commit is contained in:
Hermes Agent service account
2026-05-29 23:13:49 -05:00
parent dcb764eca7
commit 8fd9fd5b20

View File

@@ -305,7 +305,9 @@
'survey_vars': item.survey_vars | default([]) 'survey_vars': item.survey_vars | default([])
} }
| combine( | combine(
{'vault_key_id': _semaphore_key_ids[item.vault_password] | int} {'vaults': [{'id': 0,
'vault_key_id': _semaphore_key_ids[item.vault_password] | int,
'name': 'default'}]}
if item.vault_password is defined else {} if item.vault_password is defined else {}
) )
}} }}