Managed By Ansible

If your servers are managed via configuration management tools, like Ansible, then you won't want people editing files manually.

Sometimes a gentle reminder is all that is needed.

I like to put a custom message of the day in to remind people that config management is the way to do things. If that's what you want then take advantage of an Ansible role for it:

mrlesmithjr's rather excellent role

I also tend to stick a comment in the top of Ansible managed templates:

{{ansible_managed|comment('c')}}

If you are creating a template for a file which has a different syntax for comments consider using this instead:

 {{ansible_managed|comment('c')|replace('//','#')}} 

In the above example you'd be replacing

//

with

#

.

For this to work your ansible.cfg needs to contain something for ansible_managed:

ansible_managed = This file is managed by Ansible%n
 template: {file}
 date: %Y-%m-%d %H:%M:%S (mtime of the source template, NOT this output)
 user: {uid}
 host: {host}