Interview Q&A · questions with model answers

Ansible Interview Questions

Part of the study plan for: DevOps Engineer

Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.

  1. Most asked How do you manage secrets with Ansible Vault?

    Ansible Vault encrypts files or single variables with AES-256 so secrets can live in the repository encrypted. Keep secrets in dedicated vault files (group_vars/prod/vault.yml), reference them from…

  2. How do you structure reusable Ansible roles for several environments?

    Put everything that varies by environment into variables, give each role safe defaults in defaults/main.yml, and keep environment values in separate inventories (inventories/dev, inventories/prod)…

  3. How would you automate TLS certificate installation and renewal with Ansible?

    Either let an ACME client on each host renew certificates (Ansible installs and configures certbot or acme.sh and a timer), or let Ansible own the lifecycle with community.crypto.acme_certificate,…

  4. How would you configure 100 Linux servers consistently with Ansible?

    Describe the desired state once in roles (users, SSH hardening, packages, time sync, logging, monitoring agent), target servers through a dynamic or well-grouped inventory, and roll changes out in…

  5. How do Ansible and Terraform work together in one delivery pipeline?

    Terraform creates and changes the infrastructure (networks, VMs, load balancers) and records it in state; Ansible configures what runs on the machines. In a pipeline, Terraform applies first and…

  6. How do you test Ansible roles before they reach production?

    Lint every change with ansible-lint and yamllint, test roles in throwaway containers or VMs with Molecule (converge, verify, then converge again to prove idempotency), run playbooks in --check…

Was this page helpful?

Report a mistake