Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use {{ ansible_managed }} instead of 'This file is managed by Ansible, all changes will be lost'? #120

Open
ypid opened this issue Jul 27, 2015 · 6 comments

Comments

@ypid
Copy link
Member

ypid commented Jul 27, 2015

What do you think?

Currently it is only used in a few places.

Is your debops.plan related to this?

@nickjj
Copy link
Contributor

nickjj commented Jul 27, 2015

We used {{ ansible_managed }} in the past and changed it to a static string because {{ ansible_managed }} was creating idempotency issues.

@ypid
Copy link
Member Author

ypid commented Jul 27, 2015

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.

@nickjj
Copy link
Contributor

nickjj commented Jul 27, 2015

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?

@drybjed
Copy link
Member

drybjed commented Jul 27, 2015

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).

@ypid
Copy link
Member Author

ypid commented Jul 27, 2015

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'

ypid referenced this issue in ypid/ansible-rsnapshot Aug 6, 2015
* Would not be found be debops/debops#120
* git ls-files | xargs sed -i 's/This file is managed remotely, all changes will be lost/{{ ansible_managed }}/'
ypid referenced this issue in ypid/ansible-rsnapshot Aug 6, 2015
* Would not be found by debops/debops#120
* `git ls-files | xargs sed -i 's/This file is managed remotely, all changes will be lost/{{ ansible_managed }}/'`
ypid referenced this issue in ypid/ansible-pki Aug 6, 2015
* Would not be found by debops/debops#120
* `git ls-files | xargs sed -i 's/\(This file is managed remotely, all changes will be lost|This file is managed remotely, some changes might be overwritten\)/{{ ansible_managed }}/'`
ypid referenced this issue in ypid/ansible-pki Aug 6, 2015
* Would not be found by debops/debops#120
* `git ls-files | xargs sed -i 's/\(This file is managed remotely, all changes will be lost\|This file is managed remotely, some changes might be overwritten\)/{{ ansible_managed }}/'`
ypid referenced this issue in ypid/ansible-etherpad Oct 5, 2015
ypid referenced this issue in ypid/ansible-redis Jun 28, 2016
@geerlingguy
Copy link

Note that the {{ ansible_managed }} string is now static by default—see https://github.com/ansible/ansible/pull/18094/files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants