copy module: modify time on the file (mtime) is not updating #83013
Labels
affects_2.17
bug
This issue/PR relates to a bug.
has_pr
This issue has an associated PR.
module
This issue/PR relates to a module.
P3
Priority 3 - Approved, No Time Limitation
Summary
Using the
ansible.builtin.copy
module to update the contents of a file that already exists is not updating themodify
file descriptor on the file even though the file contents are updated.This appears to have been introduced around
2.17
:2.16.5.post0
- works2.17.0.dev0
- works2.17.0b1.post0
- does not work2.18.0.dev0
- does not workIssue Type
Bug Report
Component Name
copy
Ansible Version
Configuration
OS / Environment
Ansible controller: Ubuntu 22.04.2 LTS
Ansible remote target: Ubuntu 20.04.6 LTS"
Steps to Reproduce
Create file on
target-hostname
, run below on target hostecho "Test content" >> /tmp/test
Collect stat data
stat /tmp/test
Execute ansible to update file contents
ansible all -i "target-hostname," -m ansible.builtin.copy -a "content=test2 dest=/tmp/test"
Note that the task is marked as changed:
Compare stat data and note that
modify
(and evenaccess
) have not been updatedExpected Results
I expect
modify
andaccess
to be updated viastat
when usingansible.built.copy
to update file contents:Actual Results
The text was updated successfully, but these errors were encountered: