Ansible is stateless. So it doesn't know if the remote file exists in the way you have it because you changed it on the remote system or because a previous ansible run dropped that version of hte file there. If you want Ansible to ensure that the remote file matches what you have at your source then you must have force: yes. If you want ansible to always respect remote changes then you have force: no.
You can come up with your own method to track remote state to determine whether to overwrite the file or not (by taking a hash of previous files pushed out by ansible and saving it somewhere for comparison in the future) you certainly can write several tasks to take care of that but that is outside of the scope of what's built into Ansible. -Toshio On Wed, Nov 1, 2017 at 9:00 AM, John Harmon <[email protected]> wrote: > Yes, but the contents of the file change.... the force option is set that > way on purpose so I don't overwrite any local changes if they exist. > > On Wednesday, November 1, 2017 at 9:59:30 AM UTC-6, Brian Coca wrote: >> >> force: no prevents a copy if the dest file exists >> >> >> >> >> -- >> ---------- >> Brian Coca > > -- > 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 post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/742ab2e7-8d00-488d-becd-6546d408668e%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAPrnkaT6aw08XpvcG%2B1Qms_W1pJCz%2BJDGnVwL18tkERsSBHRCg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
