# ansible always reports changed

**URL:** <https://forum.ansible.com/t/ansible-always-reports-changed/28825>\
**Category:** Ansible Project\
**Created:** [October 19, 2018, 8:03am UTC](https://forum.ansible.com/t/ansible-always-reports-changed/28825 "2018-10-19T08:03:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jost](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@Jost](https://forum.ansible.com/u/Jost)\
**Post date:** [October 19, 2018, 8:03am UTC](https://forum.ansible.com/t/ansible-always-reports-changed/28825/1 "2018-10-19T08:03:46Z")

</div>

Hi

I have ansible 2.6.5 and I notice one strange think. If I use hard code path for “item.dest” then reports no changed. Change is reported only if I change something inside plugins which is OK

- name: install plugins  
copy:  
src: “{{ item.src }}”  
dest: “{{ item.dest }}”  
mode: 0755  
owner: root  
group: root  
with\_items:
- { src: mk\_logins,dest: ‘/usr/lib/check\_mk\_agent/plugins’}
- { src: symantec\_av,dest: ‘/usr/lib/check\_mk\_agent/plugins’}

TASK [check-mk-agent : install plugins] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [rhl1] =\> (item={u’dest’: u’/usr/lib/check\_mk\_agent/plugins’, u’src’: u’mk\_logins’})  
ok: [rhl1] =\> (item={u’dest’: u’/usr/lib/check\_mk\_agent/plugins’, u’src’: u’symantec\_av’})

but if I use variable for path “/usr/lib/check\_mk\_agent/plugins” then ansible always reports changed when I run ansible-playbook

variable in defaults/main.yml

plugins\_dir: ‘usr/lib/check\_mk\_agent/plugins’

- name: install plugins  
copy:  
src: “{{ item.src }}”  
dest: “{{ item.dest }}”  
mode: 0755  
owner: root  
group: root  
with\_items:
- { src: mk\_logins,dest: plugins\_dir }
- { src: symantec\_av,dest: plugins\_dir }

TASK [check-mk-agent : install plugins] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [rhl1] =\> (item={u’dest’: u’plugins\_dir’, u’src’: u’mk\_logins’})  
changed: [rhl1] =\> (item={u’dest’: u’plugins\_dir’, u’src’: u’symantec\_av’})

So question is why is this happen?

Thanks

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 19, 2018, 8:45am UTC](https://forum.ansible.com/t/ansible-always-reports-changed/28825/2 "2018-10-19T08:45:56Z")

</div>

> variable in defaults/main.yml
> 
> plugins\_dir: 'usr/lib/check\_mk\_agent/plugins'
> 
> - name: install plugins  
> &nbsp;&nbsp;copy:  
> &nbsp;&nbsp;&nbsp;&nbsp;src: "{{ item.src }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;dest: "{{ item.dest }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;mode: 0755  
> &nbsp;&nbsp;&nbsp;&nbsp;owner: root  
> &nbsp;&nbsp;&nbsp;&nbsp;group: root  
> &nbsp;&nbsp;with\_items:  
> &nbsp;&nbsp;&nbsp;&nbsp;- { src: mk\_logins,dest: plugins\_dir }  
> &nbsp;&nbsp;&nbsp;&nbsp;- { src: symantec\_av,dest: plugins\_dir }

Your plugins\_dir in these two last line is not a variable since it's missing {{ }} around them so they are literally the string plugins\_dir.

> TASK [check-mk-agent : install plugins]  
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> changed: [rhl1] =\> (item={u'dest': u'plugins\_dir', u'src': u'mk\_logins'})  
> changed: [rhl1] =\> (item={u'dest': u'plugins\_dir', u'src': u'symantec\_av'})

As you can see here dest contains 'plugins\_dir' and not the content of the variable plugins\_dir.

---

<div class="post-metadata">

**Author:** ![Jost](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@Jost](https://forum.ansible.com/u/Jost)\
**Post date:** [October 19, 2018, 9:00am UTC](https://forum.ansible.com/t/ansible-always-reports-changed/28825/3 "2018-10-19T09:00:40Z")

</div>

Thanks it works now.

- name: install plugins  
copy:  
src: “{{ item.src }}”  
dest: “{{ item.dest }}”  
mode: 0755  
owner: root  
group: root  
with\_items:
- { src: mk\_logins,dest: “{{ plugins\_dir }}” }
- { src: symantec\_av,dest: “{{ plugins\_dir }}” }
