# Templates don't get --check'ed right in v2

**URL:** <https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697>\
**Category:** Ansible Developer\
**Created:** [November 5, 2015, 6:17pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697 "2015-11-05T18:17:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Logan\_McNaughton](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@Logan\_McNaughton](https://forum.ansible.com/u/Logan_McNaughton)\
**Post date:** [November 5, 2015, 6:17pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/1 "2015-11-05T18:17:15Z")

</div>

I am testing out Ansible 2 (checkout from Git). And it doesn’t seem to be comparing templates properly. When I run a playbook with a template in 1.9.4, using --check --diff, it’ll show me the differences. When I run the same playbook in v2, it says “ok”.

Has anyone else run into this?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 5, 2015, 6:21pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/2 "2015-11-05T18:21:31Z")

</div>

--diff is needed to show the differences

---

<div class="post-metadata">

**Author:** ![Logan\_McNaughton](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@Logan\_McNaughton](https://forum.ansible.com/u/Logan_McNaughton)\
**Post date:** [November 5, 2015, 7:15pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/3 "2015-11-05T19:15:52Z")

</div>

Sorry maybe I typed it wrong, I am using --check and --diff, in v2 it is showing “ok” (which would still be a problem if I wasn’t using --diff), but in 1.9.4 it is properly showing the differences.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 5, 2015, 7:34pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/4 "2015-11-05T19:34:01Z")

</div>

actuall, OK means 'no change', it should only show a diff if it  
returns 'Changed'

---

<div class="post-metadata">

**Author:** ![Logan\_McNaughton](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@Logan\_McNaughton](https://forum.ansible.com/u/Logan_McNaughton)\
**Post date:** [November 5, 2015, 7:35pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/5 "2015-11-05T19:35:56Z")

</div>

That’s what I’m saying. I have a file that differs from the template, when I run the playbook in v2, it says “OK”, when I run the playbook in 1.9.4, it says “Changed” and shows me the diff.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 5, 2015, 7:39pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/6 "2015-11-05T19:39:01Z")

</div>

is the diff a trailing newline?

---

<div class="post-metadata">

**Author:** ![Logan\_McNaughton](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@Logan\_McNaughton](https://forum.ansible.com/u/Logan_McNaughton)\
**Post date:** [November 5, 2015, 8:18pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/7 "2015-11-05T20:18:18Z")

</div>

No the files are quite different

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 5, 2015, 8:21pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/8 "2015-11-05T20:21:06Z")

</div>

i cannot reproduce with my own tests, do you have a minimal test case?

---

<div class="post-metadata">

**Author:** ![Logan\_McNaughton](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@Logan\_McNaughton](https://forum.ansible.com/u/Logan_McNaughton)\
**Post date:** [November 5, 2015, 8:27pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/9 "2015-11-05T20:27:01Z")

</div>

I have attached a playbook that I can reproduce the results with.

When I run that like this:  
ansible-playbook -c local -i “localhost,” site.yml --check --diff

**Here is my output (1.9.4):**

PLAY [all] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost]

TASK: [common | Template test] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
— before: /home/loqd/ansitest/hello  
+++ after: /net/calsvm01/home/home/loqd/ansitest/roles/common/templates/hello.txt.j2  
@@ -1 +1 @@  
-THIS IS NOT THE TEMPLATE  
+THIS IS THE TEMPLATE

changed: [localhost]

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=2 changed=1 unreachable=0 failed=0

**Here is my output (v2.0.0-0.4.beta2 git checkout):**

PLAY \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [setup] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost]

TASK [common : Template test] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost]

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=2 changed=0 unreachable=0 failed=0

> **(attachments)**
>
> [ansitest.zip](https://forum.ansible.com/uploads/short-url/phdX5tzth5yrkrwnNAO96wUda7s.zip) (1.74 KB)

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 5, 2015, 8:43pm UTC](https://forum.ansible.com/t/templates-dont-get-checked-right-in-v2/19697/10 "2015-11-05T20:43:51Z")

</div>

so diff seems to be working fine, its the check mode that is the problem
