Skip to content
$ lynuxpro

INTERVIEW PREP

Interview questions

570 questions from real DevOps, SRE, platform engineering and MLOps interviews, with the answer an interviewer wants to hear. Try answering out loud first, then open the model answer.

Showing 1–9 of 9 questions

Learn Ansible →
1.How do block, rescue and always work?Senior

block holds the normal tasks. If one fails, rescue runs, for example to roll back. always runs in either case, like finally.

2.How would you speed up a slow playbook?Senior

Raise forks, turn on SSH pipelining and connection reuse, cache or skip facts, use the free strategy where safe, run long jobs async, and measure with profile_tasks.

3.How do you test a role?Senior

With Molecule: start a disposable container, converge the role, run it again to check idempotence, run verify checks, and destroy the container. Run it in CI on every change.

4.How do you run Ansible safely in CI/CD?Senior

Lint and dry-run (--check --diff) on merge requests, deploy from the main branch with a manual gate, keep SSH keys and the vault password in protected variables, and pin versions.

5.What is a collection, and why pin versions?Senior

A package of modules, roles and plugins named namespace.collection. Pinning versions in requirements.yml keeps runs the same and stops upstream updates from changing behaviour.

6.When would you write a custom module?Senior

Only when no existing module or collection can do the job, such as for an internal API. It must be idempotent, support check mode, return correct JSON and be documented.

7.What does AWX or Ansible Automation Platform add?Senior

A web page and API with role-based access, stored credentials, job templates, workflows with approvals, schedules, notifications and an audit trail. Jobs run in execution environments, which are container images with a fixed Ansible and libraries.

8.What are the limits of --check mode?Senior

Modules that support it report what they would change, but command, shell and some other tasks are skipped because Ansible cannot predict them. Later tasks that depend on skipped results can also look wrong. Treat a dry run as a good preview, not a guarantee.

9.What do run_once, delegate_to and throttle do?Senior

run_once runs a task on only one server of the group, for example a database migration. delegate_to runs a task on a different machine, for example to take a server out of a load balancer. throttle limits how many servers run that one task at the same time.