Menu

Ansible 2.20 gotchas: string booleans from -e, tags that drop fact gathering, and lost handlers
📰

Ansible 2.20 gotchas: string booleans from -e, tags that drop fact gathering, and lost handlers

DEV Community: ansible·Hécate R.·1 day ago
#OhTaqeLd
#devtoansible#devto#dev#config#ansible
Long article (1046 words) — no AI summary yet.
Reading 0:00
15s threshold

Since ansible-core 2.19, Ansible is much stricter about types, and Ansible 2.20 made the consequences visible in my playbooks. Migrating, I hit three traps in a row: a boolean that was really a string, fact gathering that silently disappeared when a play carried tags, and handlers that never ran after an interrupted run. Each one hides a real bug rather than creating one, which is why they are worth knowing.

Each trap, why it happens and the fix.

At a glance

Trap What you see Fix

-e var=false is a string Conditional result (True) was derived from value of type 'str' Pass JSON or a file, or use `

Play-level {% raw %} tags: removes the always tag from fact gathering Tasks reading ansible_facts fail or get it wrong on --tags runs gather_facts: false plus an explicit setup task tagged always

Lost handlers changed=0 on the re-run, but the service still runs the old config Restart by hand, force_handlers , flush_handlers , and validate before installing

-e var=false is not a boolean

The most visible…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.