Automation
AWX: validate credential rotation before resuming production jobs
A production runbook for separating secret lookup failures from target authentication and safely resuming AWX jobs after rotation.
Several AWX jobs fail after an SSH key rotation. Replacing the key everywhere or replaying the entire queue can make the incident worse: the break may be in vault access, the linked secret field, the target’s authorized key, or privilege escalation.
In this fictional case, a Machine credential obtains its private key from an external secret manager and a maintenance job targets Linux hosts. The goal is to find the failed boundary without exposing the key, prove the path on a canary, and make an explicit decision before retiring the old access.
Contain the incident and capture the contract
Pause affected schedules and coordinate with the target owners. Jobs already running may continue; identify them and their effects before considering cancellation. Record the failed job ID and UTC window, template, project and revision, inventory, effective limit, execution environment and credential IDs. Capture the last success and first failure without exporting secrets or unredacted output.
Separately record the source credential used to access the vault, the target Machine credential and linked field, the secret path or identifier, and the expected version where available. AWX can map credential fields to an external secret manager, but the details depend on the plugin and version. A successful link test alone does not prove that the host will accept the key.
| Symptom | Boundary to investigate | Next evidence |
|---|---|---|
| Failure before host connection, lookup error | Vault access, secret reference or version | Link test, vault identity, audit and time |
| Secret retrieved, SSH authentication denied | User, authorized public key, target and SSH policy | SSH logs and expected public fingerprint |
| Connection succeeds, privilege escalation fails | Become user, method and permissions | Exact failing step and sudo logs |
| Only some hosts fail | Partial key rollout or wrong target scope | Compare host groups and timestamps |
A generic error is not enough to assign a cause. Align job, vault and host timestamps; a missing log is not proof that no request occurred.
Check the vault, then the target
Inspect the linked field, source credential, reference and read permissions. Use the plugin’s link test where available without displaying the value. Check vault audit records for the identity and served version when available. A reference pinned to an old version may behave differently from one following the current version. Do not assume caching or retrieval behavior from another installation; verify the deployed version and plugin.
Once lookup succeeds, compare the effective user, port, target hostname and expected public key fingerprint with the canary’s authorized configuration. Do not paste private keys into tickets or enable verbosity that may disclose secrets. If authentication succeeds but the job later fails, investigate become, permissions and the playbook as separate steps. Avoid widening privileges to conceal an identity error.
Canary and controlled resumption
Prepare an approved diagnostic template using the same project, environment and credential path as the real job, but an explicitly read-only operation. Limit it to one representative canary and verify the resolved inventory and effective limit before launch. Confirm the remote identity and read a non-sensitive state, then inspect vault and target logs. A lookup test alone is not an end-to-end test. If maintenance requires become, also validate an approved non-destructive privilege check.
Only then run the real operation on a small authorized batch, after reviewing impact and idempotency. Compare expected outcomes with observed changes; expand in batches with a named owner, time window and stop threshold. Reconcile already processed hosts before retrying: a failed job may have completed some changes.
Decide or roll back
Resume schedules only when the canary, representative groups and business checks pass without new denials or unexpected effects. Check other consumers of the secret before revoking the old access.
If validation fails, stop resumption and restore the previous reference or credential through the approved change process only if the old access is still valid and not compromised. If compromised, do not reactivate it: isolate the scope and follow the emergency replacement procedure. Verify recovery with a new limited job. Rolling back a credential does not undo actions already performed on hosts; remediation requires a separate decision and plan.