Using ansible 2.6
In our playbook, we are using the git module to checkout a specific repo. Most of the time, the playbook reports this as changed even though the repo has not changed. Sometimes it does properly report as not changed.
Here is the git module parameters:
- name: checkout our repo
git:
repo: “git@{{ serverurl }}:repo.git”
dest: /opt/repofolder
key_file: /path/.ssh/sshkey
ssh_opts: “-o StrictHostKeyChecking=no”
accept_hostkey: True
update: yes
become_user: localuser
When it reports as changed, it returns:
“after”: “f35210a1d1d008e5a7abc328733cab87c06589a6”,
“before”: “f35210a1d1d008e5a7abc328733cab87c06589a6”,
“changed”: true,
“remote_url_changed”: true
I’ve duplicated the directory and compared the entire directory. Some folders have a newer modified date. But no files were changed, with one exception, the file /opt/repofolder/.git/logs/HEAD has this added line:
f35210a1d1d008e5a7abc328733cab87c06589a6 f35210a1d1d008e5a7abc328733cab87c06589a6 localuser localuser@computername.com 1572275580 +0000 checkout: moving from master to master
That line gets added even when ansible reports no change. And also, we use these same settings in other playbooks for other repos and those correctly only report as changed when changed.
Any idea why this is happening?
Thanks.