Ambari database acts as the source of truth for configuration files of services it manages.
This means that if you edit configuration files managed by Ambari in the file system, Ambari will overwrite them the next time they are refreshed due to service / component restart, client config refresh, etc.
Instead of modifying these files directly on the file system, you need to modify the configurations or the file templates, depending on what files you want to modify.
TODO: Give examples