{
  "id": 8591266,
  "title": "I let an LLM judge inside Python's if statements, then ran Ansible's own tests on it",
  "url": "https://urgent.news/2026/09/20/i-let-an-llm-judge-inside-pythons-if-statements-then-ran-ansibles-own",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-20T02:34:02.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/tdual/i-let-an-llm-judge-inside-pythons-if-statements-then-ran-ansibles-own-tests-on-it-43fo"
  },
  "original_language": "en",
  "account": "The author created a library called fuzzyif that allows users to input a question in plain language where a Python if condition would typically go. With the library installed via pip install fuzzyif, users can access functions like fuzzy(question, text) to determine if a given text matches the provided question. The library was then integrated into Ansible's distribution detection system, replacing a large number of if/elif statements.\n\nAnsible, the automation tool, uses distribution detection to determine the operating system and family (Debian-like, RedHat-like, etc.) of a host. This information is crucial for Ansible to execute the appropriate playbooks and tasks. The original distribution detection code spanned 786 lines, filled with if/elif conditions for matching specific strings in release files like /etc/os-release and parsing this information into distribution and family information.\n\nBy replacing this complex code with fuzzy_match calls using fuzzyif, the entire distribution detection process was condensed from 786 lines down to just 450 lines. The author then ran Ansible's own test suite, comprised of 90 fixtures containing real /etc/*-release contents from various machines, against the modified code. The results showed that 65 of the 90 fixtures matched exactly, while 25 fixtures had at least one key difference between the original and modified code. The largest discrepancy was observed in the version, major version, and distribution_release data, where the modified code using fuzzy_match failed to produce the same output as the original code.",
  "summary": "I wrote a small library that lets you put a question, in plain language, where a Python if condition goes. from fuzzyif import fuzzy if fuzzy ( \" Is this message urgent? \" , msg ): notify_oncall ( msg ) It is called fuzzyif. pip install fuzzyif . The code is here: https://github.com/Tdual/fuzzyif This post is about two things: what the library actually does, and whether it can replace a real pile…",
  "key_points": [
    "Author created fuzzyif library for plain language Python if conditions",
    "Integrated fuzzyif into Ansible's distribution detection system",
    "Reduced 786 lines of code to 450 lines while maintaining 65% accuracy"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}