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