Skip to content

Top 31 Ansible Interview Questions and Answers [2026]

November 15, 2026 27 min read
Ansible interview guide by Second Talent
TL;DR: Ansible interviews in 2026 test whether a candidate writes idempotent tasks, understands variable precedence and inventory design, and can ship automation as collections inside an execution environment. Candidates should know ansible-core 2.22.0 (November 2, 2026), the Ansible 14.6.0 community package (November 4, 2026, built on ansible-core 2.21), the stricter templating that arrived in 2.19, and the secret masking added in 2.22.

Since ansible-core 2.22, registered secrets such as decrypted vault values and no_log parameters are replaced with $REDACTED$ in screen output, the log file and callback data, and the debug module no longer prints them.

The ansible-core 2.22 porting guide lists the behavior changes that come with it. The questions below are for DevOps, platform and infrastructure engineer interviews, with four find-the-bug rounds and two design questions.

Key takeaways
  1. 1ansible-core 2.22 needs Python 3.13 or later on the control node, while managed nodes still accept Python 3.9 and up.
  2. 2Since 2.19, a when condition that does not evaluate to a boolean raises an error instead of being tested for truthiness.
  3. 3INJECT_FACTS_AS_VARS is deprecated and flips to False in ansible-core 2.24, so ansible_hostname style variables stop working; use ansible_facts['hostname'].
  4. 4ansible-builder 3.2.0 (October 13, 2026) deprecates versions 1 and 2 of the execution environment file format; version 3 is the one to write.

Architecture and Inventory

1. What is the difference between ansible-core and the ansible package?

ansible-core is the engine: the CLI tools, the playbook language, connection and become plugins, and the ansible.builtin collection.

The ansible package on PyPI is a community bundle that pins one ansible-core major version and adds a curated set of collections such as community.general, amazon.aws and ansible.posix.

Per the release and maintenance page, Ansible 14.x uses ansible-core 2.21 and Ansible 15.0.0, now in beta, will use 2.22.

The two version numbers confuse candidates who only ever ran pip install ansible.

A strong answer explains why production teams often install ansible-core alone and pin collections in a requirements.yml: the bundle is large, it moves dozens of collections at once, and only the latest community major gets fixes. ansible-core keeps three majors in maintenance at a time, with a new major every May and November.

2. How does Ansible run a task on a managed node?

For a Python module, the controller packages the module code and its arguments into a self-contained payload (AnsiballZ), copies it to a temporary directory on the target over the connection plugin (SSH by default), runs it with the target's Python interpreter, reads the JSON result from stdout and deletes the temp files.

No agent stays on the host. Action plugins such as template and copy run part of their work on the controller first, which is why templates render with controller-side variables and Jinja filters.

Follow-ups worth asking: which tasks need no Python on the target (raw, and script for the upload itself), how become wraps the command with sudo or another become plugin, and what pipelining changes (question 26).

A candidate who has debugged a broken host should mention ANSIBLE_KEEP_REMOTE_FILES=1 to inspect the payload, and -vvvv to see the SSH commands.

3. Static or dynamic inventory: how do you choose, and how do you structure it?

Use a static YAML or INI inventory for hosts that rarely change, and an inventory plugin for anything a cloud or CMDB already tracks.

Plugins such as amazon.aws.aws_ec2 or azure.azcollection.azure_rm read a small YAML config, query the API at run time and build groups from tags, regions or instance types.

The constructed plugin then adds groups and variables computed from existing host vars.

# inventories/prod/aws_ec2.yml
plugin: amazon.aws.aws_ec2
regions:
  - us-east-1
filters:
  tag:env: prod
  instance-state-name: running
keyed_groups:
  - key: tags.role
    prefix: role
hostnames:
  - private-ip-address
compose:
  ansible_host: private_ip_address

A senior candidate keeps one inventory directory per environment, each with its own group_vars and host_vars, so that -i inventories/staging can never touch production hosts.

They also know ansible-inventory -i inventories/prod --graph and --host <name> for checking what the plugin produced before a run.

4. Explain variable precedence. Where should a role's tunable values live?

Ansible merges variables from more than twenty sources, and the variables guide lists the order. The points that matter in practice:

  • Role defaults (defaults/main.yml) are the lowest priority of all, which makes them the right home for anything a user of the role should override.
  • Inventory group_vars and host_vars sit above defaults; host vars beat group vars, and child groups beat parent groups.
  • Role vars (vars/main.yml), play vars, set_fact and registered vars rank higher, so putting a tunable in vars/main.yml makes it hard to override from inventory.
  • Extra vars (-e) always win.

The weak answer recites the list.

The strong answer says they keep the number of places a variable can be set small, prefix role variables with the role name (nginx_worker_processes) to avoid collisions, and reach for -e only for run-time switches, because an extra var silently beats every other source.

5. How do group_vars from two groups resolve when a host belongs to both?

Groups at the same depth merge in alphabetical order by group name, so the group that sorts last wins. A host in both app and web gets web's value for a shared key.

Child groups override their parents regardless of name, and ansible_group_priority on a group changes the order for groups at the same level.

Dictionaries are replaced, not merged, under the default hash_behaviour.

A candidate who has hit this will mention the combine filter for explicit merging and say they avoid changing hash_behaviour globally, since it alters behavior for every role in the project.

Ask them to predict the result before running ansible-inventory --host; candidates who guess rarely get it right.

6. What are facts, and when should you turn off fact gathering?

Facts are host data collected by the setup module at the start of each play: OS family, interfaces, mounts, memory and more, stored under ansible_facts.

Gathering costs a round trip and some CPU per host, so plays that do not use facts should set gather_facts: false, and plays that need only some can call setup with gather_subset.

For large fleets, a fact cache (fact_caching = jsonfile or redis, with gathering = smart) lets later runs reuse facts until fact_caching_timeout expires.

A current answer also mentions that INJECT_FACTS_AS_VARS is deprecated: per the 2.20 porting guide it switches to False in 2.24, so ansible_os_family becomes ansible_facts['os_family'].

Playbooks and Idempotence

7. What does idempotent mean for a task, and how do you make command tasks idempotent?

An idempotent task reaches the desired state on the first run and reports ok with no changes on every run after it.

Most modules (package, file, lineinfile, template, service) check current state before acting. command and shell cannot know, so they report changed every time unless you tell them otherwise.

- name: Initialize the database once
  ansible.builtin.command:
    cmd: /opt/app/bin/init-db
    creates: /var/lib/app/.initialized

- name: Read the current schema version
  ansible.builtin.command: /opt/app/bin/schema-version
  register: schema
  changed_when: false

The tools are creates and removes, changed_when based on the command's output, and, best of all, a real module instead of a command.

A strong candidate measures idempotence the way Molecule does: run the playbook twice and fail the build if the second run reports any change.

8. Find the bug: a task that adds a hosts entry.

- name: Add internal registry to /etc/hosts
  ansible.builtin.shell: echo "10.0.4.12 registry.internal" >> /etc/hosts
  become: true

It appends a new line on every run, so after a month of nightly runs the file has thirty copies, and the task always reports changed, which hides real drift. It also uses shell for a redirect that a module handles.

- name: Add internal registry to /etc/hosts
  ansible.builtin.lineinfile:
    path: /etc/hosts
    regexp: '\sregistry\.internal$'
    line: "10.0.4.12 registry.internal"
  become: true

With regexp, a changed IP replaces the old line instead of adding a second one. Good candidates also mention blockinfile for multi-line blocks and say that a file Ansible fully owns should be a template, not a series of line edits.

9. How do handlers work, and what can go wrong with them?

A task that reports changed and has notify queues a handler.

Handlers run once, at the end of each play section (after pre_tasks, roles and tasks, and post_tasks), in the order they are defined in the handlers list, not the order they were notified. meta: flush_handlers runs pending handlers immediately.

The failure cases a senior candidate names:

  • If a later task fails on a host, that host's queued handlers do not run, so a config change lands without the service restart. --force-handlers or force_handlers: true changes that.
  • A notify name that does not match any handler or listen topic is an error, but a typo in a conditional notify on a rarely changed task can sit unnoticed for months.
  • Handlers in a role are visible to the whole play, so two roles with a handler named restart app collide; listen topics and role-prefixed names avoid it.

10. Find the bug: a conditional that worked on Ansible 2.18.

- name: Check for pending updates
  ansible.builtin.command: /usr/local/bin/pending-updates
  register: updates
  changed_when: false

- name: Reboot when updates are pending
  ansible.builtin.reboot:
  when: "{{ updates.stdout }}"

Two problems, both errors on ansible-core 2.19 and later. Per the 2.19 porting guide, when is already an expression, and embedded templates inside an expression are no longer supported.

And a conditional must evaluate to a boolean; a non-empty string no longer counts as true.

  when: updates.stdout | trim | length > 0

ALLOW_BROKEN_CONDITIONALS turns the error into a warning during a migration, and a strong candidate treats it as temporary.

They also note the older bug the new rule exposes: under truthy evaluation, a command that printed 0 or false would still have triggered the reboot, because both are non-empty strings.

11. How do loops and register interact?

A registered variable on a looped task holds a results list with one entry per item, each carrying the item and that iteration's return values. Code that reads result.rc or result.stdout directly on a looped task finds nothing there.

- name: Check each service
  ansible.builtin.command: systemctl is-active {{ item }}
  loop: "{{ app_services }}"
  register: svc
  changed_when: false
  failed_when: false

- name: Report inactive services
  ansible.builtin.debug:
    msg: "{{ svc.results | rejectattr('rc', 'eq', 0) | map(attribute='item') | list }}"

A candidate should prefer loop over the older with_* keywords for new code, use loop_control: label to keep output readable for large dictionaries, and know that passing a list straight to a module such as package (name: "{{ pkgs }}") is one transaction, which is far faster than looping one package at a time.

12. How do block, rescue and always work?

block groups tasks so they share keywords such as become, when and tags. If a task in the block fails, rescue runs, and always runs whatever happened. A failure handled by rescue counts as rescued, and the play continues on that host.

- name: Deploy with rollback
  block:
    - name: Switch symlink to new release
      ansible.builtin.file:
        src: "/opt/app/releases/{{ app_version }}"
        dest: /opt/app/current
        state: link
    - name: Health check
      ansible.builtin.uri:
        url: http://127.0.0.1:8080/healthz
        status_code: 200
      retries: 10
      delay: 3
      register: hc
      until: hc.status == 200
  rescue:
    - name: Restore previous release
      ansible.builtin.file:
        src: "/opt/app/releases/{{ previous_version }}"
        dest: /opt/app/current
        state: link
    - name: Fail the host after rollback
      ansible.builtin.fail:
        msg: "Deploy of {{ app_version }} failed health check; rolled back"

The detail weak answers miss is the last task: without an explicit fail, a rescued host counts as successful, and a rolling deploy carries on to the next batch with a bad release.

Ask what ansible_failed_task and ansible_failed_result hold inside rescue.

13. What do check mode and diff mode guarantee, and where do they lie?

--check asks each module to report what it would change without changing it, and --diff shows the before and after for modules that support it, such as template, lineinfile and copy.

Together they are the closest thing Ansible has to a plan step.

The limits a candidate should know:

  • command and shell are skipped in check mode unless they set creates or removes, so their registered results are empty and later tasks that read them can fail or take the wrong branch.
  • Tasks that depend on an earlier change (install a package, then template its config into a directory the package creates) fail in check mode because the first change never happened.
  • check_mode: false on a read-only task forces it to run so later tasks have real data; check_mode: true forces a task to always run in check mode.
  • Third-party modules may not support check mode at all, and the module docs list it under attributes.

Mark secrets with no_log or keep them out of diffs, because a templated file's diff prints its contents.

Roles, Collections and Execution Environments

14. What belongs in a role, and when do you split one?

A role owns one component: install, configure and run it. The standard layout is tasks/, handlers/, defaults/, vars/, templates/, files/ and meta/, plus meta/argument_specs.yml, which validates role inputs before any task runs.

# roles/nginx/meta/argument_specs.yml
argument_specs:
  main:
    short_description: Install and configure nginx
    options:
      nginx_worker_processes:
        type: str
        default: auto
      nginx_sites:
        type: list
        elements: dict
        required: true

Split a role when two parts change for different reasons or are used without each other.

A strong candidate avoids roles that branch on a dozen when conditions to serve every OS and environment, and prefers include_tasks on ansible_facts['os_family'] with one file per family.

They also keep meta/main.yml dependencies rare, since a dependency runs implicitly and often runs more than once in a large play.

15. import_tasks or include_tasks: what is the difference?

import_* is static: Ansible reads the file when it parses the playbook, so the tasks appear in --list-tasks, tags on them work with --tags, and keywords on the import are copied to each task inside. include_* is dynamic: the file is loaded when the task runs, so the filename can come from a variable or a loop, but tags and when apply to the include itself.

The classic trap: when on an import_tasks is evaluated for every imported task, so if the first task changes the variable the condition reads, later tasks are skipped. On an include_tasks, the condition is evaluated once.

Candidates should also know that a handler written as an include_tasks can only be notified by the include's own name, not by the names of the tasks inside it, and that import_role and include_role follow the same split.

16. What is a collection, and how do you manage collection versions?

A collection is the distribution unit for modules, plugins, roles and playbooks under a namespace, such as community.postgresql.

Tasks should name modules by fully qualified collection name (ansible.builtin.copy, community.postgresql.postgresql_db) so that the right module runs regardless of what else is installed.

# collections/requirements.yml
collections:
  - name: amazon.aws
    version: ">=12.0.0,<13.0.0"
  - name: community.postgresql
    version: ">=5.0.0,<6.0.0"
  - name: ansible.posix

Install with ansible-galaxy collection install -r collections/requirements.yml, ideally into the execution environment image rather than onto a laptop.

A strong answer pins ranges, says that an unpinned collection like ansible.posix above is a reproducibility gap, and mentions that ansible-galaxy dropped the v2 Galaxy server API in 2.20, so private collection servers must speak v3.

17. What is an execution environment, and why use one?

An execution environment (EE) is a container image that holds ansible-core, ansible-runner, collections, their Python packages and system libraries.

Runs use that image instead of whatever happens to be installed on the controller, so a playbook behaves the same on a laptop, in CI and in AWX or Automation Controller.

The ansible-builder docs describe how images are built from an execution-environment.yml file.

# execution-environment.yml
version: 3
images:
  base_image:
    name: quay.io/fedora/fedora:42
dependencies:
  python_interpreter:
    package_system: python3.13
    python_path: /usr/bin/python3.13
  ansible_core:
    package_pip: ansible-core==2.22.0
  ansible_runner:
    package_pip: ansible-runner
  galaxy: collections/requirements.yml
  python: requirements.txt
  system: bindep.txt

Build with ansible-builder build -t registry.example.com/ee/platform:2026.11. ansible-builder 3.2.0 deprecated schema versions 1 and 2, so a candidate still writing version: 1 files has not touched this recently.

The base image's Python must meet the 2.22 controller minimum of 3.13; confirm the version your base image ships before pinning it. Good candidates tag images by date or Git SHA and never run production from latest.

18. What does ansible-navigator add over ansible-playbook?

ansible-navigator runs playbooks inside an execution environment by default and provides a text UI for browsing plays, tasks and host results, plus subcommands to inspect what an EE contains (collections, doc, images, config).

Each run can write a JSON artifact that can be replayed later with ansible-navigator replay, which is useful for reviewing a failed CI run.

ansible-navigator run site.yml \
  -i inventories/prod \
  --eei registry.example.com/ee/platform:2026.11 \
  --mode stdout \
  --pull-policy missing

Settings live in ansible-navigator.yml in the project, so the whole team runs the same image. The current release is ansible-navigator 26.11.0 (November 5, 2026); 26.10.0 added limited Apple Container support as a container engine.

A candidate should know the trade-off: SSH agent forwarding, file paths and inventory plugins that call cloud APIs all have to work from inside the container, which is where most first-day problems come from.

19. How do you test roles and collections?

Layer the checks from cheap to expensive:

  • ansible-lint (26.11.0 as of November 5, 2026) for syntax, FQCN use, risky shell tasks, missing name, and the production profile in CI.
  • ansible-playbook --syntax-check and --check --diff against a staging inventory.
  • Molecule to create a disposable instance, apply the role, run it a second time to prove idempotence, and run verify tasks.
  • ansible-test sanity and ansible-test units for collections that ship Python modules or plugins.

The weak answer stops at lint. The strong answer runs Molecule's idempotence step in CI for every role, uses the same EE image in CI as in production, and has at least one integration test that hits a real API for modules that wrap one.

Our CI/CD interview guide covers the pipeline side.

Secrets and Security

20. How does Ansible Vault work, and how do you handle more than one vault password?

Vault encrypts whole files or single values with AES256, and Ansible decrypts them in memory at run time. ansible-vault encrypt_string produces an inline !vault value, which keeps the variable name readable in Git while hiding the value.

Vault IDs label secrets so that different environments use different passwords.

ansible-vault encrypt_string --vault-id prod@prompt 'S3cret!' --name db_password

ansible-playbook site.yml -i inventories/prod \
  --vault-id prod@/usr/local/bin/vault-pass-client.sh

A senior candidate keeps vault passwords out of the repo, loads them through a client script that reads from a secrets manager, and rotates with ansible-vault rekey.

Many teams go further and keep secrets in HashiCorp Vault, AWS Secrets Manager or a similar store, reading them with a lookup at run time, so the repo holds no ciphertext at all.

Ask how they would revoke access for one engineer who left; with one shared vault password, the answer is rotate everything.

21. What does no_log do, and what changed about secret output in 2.22?

no_log: true on a task hides its arguments and results from output and logs. Before 2.22, values passed to module options marked no_log were stripped from results and replaced with VALUE_SPECIFIED_IN_NO_LOG_PARAMETER.

ansible-core 2.22 replaced that with registered secrets.

Decrypted vault content, no_log option values, prompted passwords and anything passed through the new register_secret filter are masked as $REDACTED$ wherever they appear in later output, including the log_path file and callback results.

Module results now keep the real value, so playbooks that compared against the old placeholder must change.

The porting guide also notes that matching is exact: a base64 or hashed copy of a secret is masked only if it is registered separately, and short secrets can be masked inside unrelated text.

22. What does this print on ansible-core 2.22?

# group_vars/all/vault.yml holds: vault_api_token: !vault | ...  (decrypts to "tok_9f2c")
- name: Show token prefix
  ansible.builtin.debug:
    msg: "token={{ vault_api_token }} prefix={{ vault_api_token[:4] }}"

The full token prints as $REDACTED$, because decrypted vault content is registered as a secret and the debug module no longer reveals registered secrets.

The four-character slice tok_ is a different string, so it prints in clear text unless someone registers it too. There is no per-task switch to turn masking off.

The question tests whether the candidate understands that masking is string matching on output, not taint tracking.

A strong answer says masking is a safety net for logs, not a reason to stop marking tasks no_log, and that derived values (substrings, encodings, URLs with a token embedded) need register_secret or should never be printed.

23. How do you run privileged tasks safely?

Connect as an unprivileged user and escalate only where a task needs it, with become: true at task or block level rather than for a whole play.

The sudo rules on the host can then be scoped, and the play's audit trail shows which tasks ran as root.

Other points a senior candidate raises: use SSH keys or short-lived certificates instead of passwords; verify host keys instead of setting host_key_checking = False, which leaves the run open to a man-in-the-middle; avoid become_user to an unprivileged user without understanding how Ansible shares temporary files with that user; and treat any shell task that interpolates a variable as an injection point, using command with argv or the quote filter instead.

Since 2.19, a become timeout is reported as an unreachable host, so ignore_errors no longer swallows it.

24. What ends up in app_motd on ansible-core 2.19 and later?

- name: Fetch app settings from the config service
  ansible.builtin.uri:
    url: https://config.internal/api/apps/web
    return_content: true
  register: cfg

- name: Render the settings into a variable
  ansible.builtin.set_fact:
    app_motd: "{{ cfg.json.motd }}"   # service returns "Welcome to {{ inventory_hostname }}"

The literal string Welcome to {{ inventory_hostname }}.

Under the trust model added in 2.19, only strings from trusted sources such as playbooks and inventory files are rendered as templates, and a value that arrives in a module result is untrusted, so its template is returned unchanged.

By default this fails silently; the experimental _ANSIBLE_TEMPLAR_UNTRUSTED_TEMPLATE_BEHAVIOR setting can raise it to a warning or error.

If the hostname should appear, have the service return a plain placeholder and swap it in with the replace filter.

A strong candidate explains why remote data must never be rendered as Jinja: it is template injection, because anyone who could write to the config service could run Jinja expressions, including lookups, on the controller.

Performance and Scale

25. A playbook against 2,000 hosts takes 90 minutes. Where do you look first?

Measure before tuning. Enable the ansible.posix.profile_tasks and ansible.posix.timer callbacks with callbacks_enabled to see which tasks cost the most, then work through the usual causes:

  • forks defaults to 5, so 2,000 hosts run in 400 waves per task. Raising it to 50 or 100 is the largest single win, limited by controller CPU and memory.
  • Fact gathering on every play; disable it or cache facts (question 6).
  • SSH setup per task; enable pipelining and keep ControlPersist connections alive (question 26).
  • Loops over packages or files that a module can take as a list in one call.
  • The linear strategy makes every host wait for the slowest one on each task; strategy: free lets fast hosts move ahead when ordering across hosts does not matter.

A candidate who has done this also splits the fleet by region with --limit or runs from controllers close to the hosts, because latency multiplies across every task.

26. What does pipelining do, and why is it off by default?

Without pipelining, each module run copies a file to the target and then executes it, which costs several SSH operations per task.

With pipelining = True in the [connection] or [ssh_connection] section, Ansible sends the module over the SSH session's stdin and runs it directly, cutting the number of operations and the time per task.

It is off by default because it fails with sudo configurations that set requiretty, which older RHEL-family defaults did.

Modern distributions mostly removed that setting, so enabling pipelining is usually safe, but a candidate should say they verify sudoers first.

They should also mention that SSH multiplexing (ControlMaster and ControlPersist) is what keeps connections open between tasks.

27. Design question: how do you roll out a change to 300 web servers without downtime?

Use serial to deploy in batches, take each batch out of the load balancer, deploy, check health and put it back, and stop the rollout if too many hosts fail.

- name: Rolling deploy
  hosts: web
  serial: [1, "10%", "25%"]
  max_fail_percentage: 0
  pre_tasks:
    - name: Drain from load balancer
      community.general.haproxy:
        state: disabled
        host: "{{ inventory_hostname }}"
        backend: web
      delegate_to: "{{ item }}"
      loop: "{{ groups['lb'] }}"
  roles:
    - role: webapp
  post_tasks:
    - name: Re-enable in load balancer
      community.general.haproxy:
        state: enabled
        host: "{{ inventory_hostname }}"
        backend: web
      delegate_to: "{{ item }}"
      loop: "{{ groups['lb'] }}"

The list form of serial sends one canary host first, then 10%, then 25% batches for the rest. max_fail_percentage: 0 stops the play when any host in a batch fails; note that the play only aborts once the failure percentage is exceeded, so a value of 10 lets one bad host in a batch of ten through.

A strong candidate adds a rescue block that leaves a failed host drained, and asks whether the app tolerates two versions running at once, because a rolling deploy guarantees it will.

28. Design question: where does Ansible stop and Terraform or Kubernetes take over?

A common split is Terraform for cloud resources and their lifecycle, and Ansible for configuring what runs inside machines, network devices and appliances.

Terraform keeps state and computes a plan from the diff, which suits resources that are created and destroyed together.

Ansible has no state file; it converges hosts toward the playbook on each run, which suits OS configuration, patching and ordered operational tasks such as a database failover.

For container workloads, Kubernetes controllers and GitOps tools own desired state, and running Ansible against a cluster's resources mostly duplicates them.

Ansible still earns its place for bootstrapping nodes, building images and running procedures that cross systems. A weak answer says "use Ansible for everything" or "Ansible is legacy".

Our Terraform and Kubernetes interview guides cover the other side of that boundary.

What Changed Recently

Jul 21, 2025
ansible-core 2.19: Data Tagging, template trust, boolean-only conditionals
Sep 9, 2025
Ansible 12.0.0 ships on ansible-core 2.19
Nov 2025
ansible-core 2.20: controller Python 3.12+, Galaxy v2 API dropped, fact injection deprecated
May 18, 2026
ansible-core 2.21: password hashing moves off passlib, PowerShell 7 targets
Jun 2, 2026
Ansible 14.0.0 on ansible-core 2.21; paramiko connection plugin removed
Oct 13, 2026
ansible-builder 3.2.0 deprecates EE file format versions 1 and 2
Nov 2, 2026
ansible-core 2.22.0: secret masking, controller Python 3.13+
Nov 4, 2026
Ansible 14.6.0, the current community package; 15.0.0b1 out a day earlier

29. What did ansible-core 2.19 change, and what breaks when you upgrade to it?

2.19 (July 21, 2025) rebuilt the templating engine and added Data Tagging, which records where each value came from, down to file, line and column where available.

Error messages now point at the source of a bad value instead of the task that used it. The porting guide lists the changes that break playbooks:

  • Conditionals must return booleans (question 10).
  • No nested templates: {{ }} inside an expression is a syntax error.
  • Template trust: strings from module results and other untrusted sources are not rendered as templates (question 24).
  • Native Jinja types only: range() returns a range object, so code that expects a list needs | list.
  • The bool filter returns only True or False, and coercing unrecognized input is deprecated, becoming an error in 2.23.
  • SSH passwords go through SSH_ASKPASS by default; password_mechanism: sshpass restores the old path.

A candidate who ran this upgrade should describe running the existing playbooks in check mode on 2.19 first, fixing conditionals, and only using ALLOW_BROKEN_CONDITIONALS as a temporary bridge.

30. What changed in ansible-core 2.20 and 2.21?

2.20 (November 2025) was mostly removals and requirement bumps.

The control node needs Python 3.12 or later and managed nodes Python 3.9 or later. ansible-galaxy dropped the Galaxy v2 server API, DEFAULT_TRANSPORT no longer accepts smart, and the vault and unvault filters lost the vaultid parameter.

With failed_when, the suppressed exception key is renamed to failed_when_suppressed_exception, which breaks playbooks that read result.exception. It also deprecated INJECT_FACTS_AS_VARS, which will default to False in 2.24.

2.21 (May 18, 2026) moved utils.encrypt from passlib to libcrypt or libxcrypt, so password_hash output can differ from earlier versions for the same input, which matters if a play compares hashes to decide whether to change a password.

Per the 2.21 porting guide, inferring failure from a non-zero rc without a failed key is deprecated, with runtime warnings from 2.22 and removal planned for 2.24. The support matrix adds PowerShell 7 as a Windows target from 2.21.

The Ansible 14 porting guide lists the removal of the deprecated ansible.builtin.paramiko connection plugin.

31. Which versions should a team standardize on in November 2026?

Per the PyPI release history, the core team shipped 2.22.0 on November 2, 2026, alongside 2.21.6, 2.20.11 and 2.19.15; the support matrix lists November 2026 as the end of life for 2.19.

The community package is at 14.6.0 (November 4, 2026) on ansible-core 2.21, and Ansible 15.0.0b1 shipped on November 3 on 2.22.

A reasonable answer for most teams: build the EE on ansible-core 2.21 or the community 14 package today, test 2.22 in a branch for the masking changes and the Python 3.13 controller requirement, and move when Ansible 15 is final.

The answer to probe for is how they decide: support window (2.21 is maintained until November 2027, 2.22 until May 2028), the Python version their base image ships, and whether their collections declare support for the new core.

Signs of a Strong Answer

  • They prove idempotence by running a role twice and treat any change on the second run as a bug.
  • They reach for a module before command or shell, and add creates or changed_when when they cannot.
  • They can say where a variable's value came from and which precedence level set it.
  • They write conditionals that return booleans and know why 2.19 started rejecting the others.
  • They pin ansible-core and collection versions inside an execution environment image and run CI from the same image.
  • They keep secrets out of Git and logs, and know that 2.22 masking matches exact strings only.

Hiring Ansible Engineers

Engineers who have run Ansible against a large fleet, migrated playbooks through the 2.19 templating changes and built their own execution environments are hard to find through job boards.

Second Talent helps US startups hire vetted AI-Native Engineers from Asia, including DevOps engineers and cloud engineers, screened with questions like these.

The DevOps engineer role guide and platform engineer role guide cover the jobs themselves, and our Docker and DevOps coding interview guides cover adjacent skills.

Rates run $23 to $39 USD an hour, billed monthly, with matches in 24 hours and a 90-day one-time replacement guarantee. Tell us what you need.

Get developers who ship with AI agents.

Starts at $23/Hour.

Start Hiring

$0 cost until you hire