Let me explain a scenario. I have an environment with several hundred servers running in it. We needed to add a few more, and the new servers need to be configured identically to the already existing servers. I have a repository of configuration files and I need to push out files from that repository to the new servers. We want to be able to tell at a glance with ‘ls -l’ that the configuration files on the new servers match the configuration files on the old servers (I am fully aware that this is not an absolute guarantee that the files are truly identical, but it does provide us with reasonable enough satisfaction). There are also other tools, such as ‘find -newer’, etc., that are impacted by the time stamps not being identical.
So, maintaining the time stamp of a file between its ultimate source and where it is installed in an important expectation. As it is now, after I have installed a file through Ansible, I am going back afterwards and using ‘touch -r’ to change the time stamps of the newly installed files to match that of the source for those files. It seems to me that I should be able to do that with the copy command without the need of this second step.
-Mark
We want to be able to tell at a glance with 'ls -l' that the configuration files on the new servers match the configuration files on the old servers (I am fully aware that this is not an absolute guarantee that the files are truly identical, but it does provide us with reasonable enough satisfaction)
A good way to do this would be to run the playbook with --check and
see if it recorded the need to make any changes.
If your systems are supposed to be identical, then I think using the command module and 'rsync' is your friend, passing an include file and appropriate arguments.
K