The condition contains an embedded template ({{ root }}
). Bare variables are already templated, so to fix you should remove the brackets and encapsulate the whole conditional in quotation marks:
when: 'ansible_distribution == "CentOS" and root == "yes"'