Use {{ ansible_managed }} instead of 'This file is managed by Ansible, all changes will be lost'?
We used {{ ansible_managed }} in the past and changed it to a static string because {{ ansible_managed }} was creating idempotency issues.
Fair enough. With a static variable defined in ansible.cfg, there should not be any issue.
I also remember that the modification time used to be included in the default ansible_managed but those times are gone: https://github.com/ansible/ansible/blob/devel/examples/ansible.cfg#L93
ansible_managed = This file is managed by Ansible, all changes will be lost.
Right, we made the change to a static string well before it was tweakable in ansible.cfg. @drybjed, what do you think about making this change?
I'm all for using {{ ansible_managed }} again, I've been doing it for some time now. No rush though - when I modify a file that has a static string, I update it to dynamic.
Nice to hear that ansible.cfg dropped the date in default value.
Yes, debops.plan is my own quasi-todo list for the project for 2015. I try to follow it, but sometimes work obligations take precedence (ie. I need to setup something else ASAP).
I think this is relatively easy doable with a short shell script. Try greping over all repos for 'This file is managed by Ansible, all changes will be lost'. Something like:
git submodule foreach git ls-files -z | xargs --null -I '{}' find '{}' -type f -print0 | xargs --null sed --in-place --regexp-extended 's/(This file is managed remotely, all changes will be lost|This file is managed remotely, some changes might be overwritten|This file is managed by Ansible, all changes will be lost)/{{ ansible_managed }}/g'
Note that the {{ ansible_managed }} string is now static by default—see https://github.com/ansible/ansible/pull/18094/files.