According to the return, it states: "remote_url_changed": true
This means that the URL for the remote is different as compared between the `repo` argument for the `git` module, and the value specified in `.git/config` within that repo. You can compare what is in `.git/config` via the command ansible uses: `git ls-remote --get-url origin` from within `/opt/repofolder` Past that, you would likely need additional debugging, following the code of the git module to determine why it's not the same value. On Mon, Oct 28, 2019 at 2:47 PM MartinBBG <[email protected]> wrote: > 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 < > [email protected]> 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. > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/5a9ce4b6-0e74-4a0c-8430-6307d061dc7c%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/5a9ce4b6-0e74-4a0c-8430-6307d061dc7c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Matt Martz @sivel sivel.net -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v8ioLcyMDFK%2Bn-0bKRgRhPev6U3iE9GBEtUc6SoKOo0Vw%40mail.gmail.com.
