Interview Prep/Ansible/Inventory and Targeting

You do not know which of 300 servers still run the vulnerable OpenSSL version. How do you find out fast?

IntermediateScenarioInventory and Targeting
Answer

Situation read → An audit task: read-only, wide, and urgent.

What I'd do →

  1. Use an ad-hoc command or package_facts with a high fork count.
  2. Collect output to a file.
ansible all -f 50 -m ansible.builtin.shell -a "openssl version" -o | tee openssl-audit.txt
ansible all -m ansible.builtin.package_facts -a "manager=auto" --tree /tmp/facts

-o gives one line per host, which is greppable.

Why → Ad-hoc is the right tool for read-only questions; no playbook needed.

Interview tip → For recurring audits, convert it to a playbook that writes a CSV with lineinfile or copy on the controller.

All Ansible questions Roadmap: Ansible

More on Inventory and Targeting