when statement doesn't get evaluated properly and always returns true when used in combination of include statement
to reproduce the error
site.yml
---
- include: rds/rds.yml
- include: elasticache/elasticache.yml
- include: acralyzer.yml
when: env == "prod"
- { include: npmserver.yml, when: env == "prod" }
then executing using the following statement
ansible-playbook site.yml --ask-vault-pass --extra-vars "env=dev" -vvvv
irrespective of the value of env when statement gets evaluated as true and npmserver.yml & acralyzer.yml gets executed.