On Fri, 17 Jun 2022 10:56:13 +0100 Antony Stone <[email protected]> wrote:
> I have a generic question about ansible, and the way it manages files on > target > (managed) systems. They're all Linux systems. > > I'm working in an environment where a colleague is running ansible scripts to > manage servers I work with, and I see that every time ansible runs, it > updates > date and time stamps on files it is managing, even when the content is > already > correct and isn't being changed. > > Is this a standard feature of ansible and the way it does configuration > management, or does it suggest that there's something incorrect or at least > inefficient about the way it's being used here? No. It's not a standard feature of Ansible. Just the opposite, in most cases the goal is to make a playbook idempotent. There should be no changes reported when running a playbook repeatedly. It depends on the module and it might be configurable. For example, the module *file* allows to preserve *access_time* and *modification_time* because you might want to configure them depending on your use case. https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html Try to find out which Ansible module(s) is/are causing the troubles. The task should report 'changed: true'. For example, the task below (running at localhost only) - file: state: touch path: /tmp/test will repeatedly report 'changed' TASK [file] ************************************************ changed: [localhost] The task will become idempotent when you set both *access_time* and *modification_time* to 'preserve' - file: state: touch path: /tmp/test access_time: preserve modification_time: preserve To move on, it will be necessary to learn details. -- Vladimir Botka -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20220617142423.2c8a62e9%40gmail.com.
pgpGZSeZSDni6.pgp
Description: OpenPGP digital signature
