mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Adding "follow" param for file/copy options
Also modifies the template action plugin to use this new param when executing the file/copy modules for templating so that links are preserved correctly. Fixes #8998
This commit is contained in:
parent
79a2e586fe
commit
b376e208c7
7 changed files with 96 additions and 13 deletions
|
@ -405,3 +405,29 @@
|
|||
that:
|
||||
- result.mode == '0444'
|
||||
|
||||
# test the file module using follow=yes, so that the target of a
|
||||
# symlink is modified, rather than the link itself
|
||||
|
||||
- name: create a test file
|
||||
copy: dest={{output_dir}}/test_follow content="this is a test file\n" mode=0666
|
||||
|
||||
- name: create a symlink to the test file
|
||||
file: path={{output_dir}}/test_follow_link src="./test_follow" state=link
|
||||
|
||||
- name: modify the permissions on the link using follow=yes
|
||||
file: path={{output_dir}}/test_follow_link mode=0644 follow=yes
|
||||
register: result
|
||||
|
||||
- name: assert that the chmod worked
|
||||
assert:
|
||||
that:
|
||||
- result.changed
|
||||
|
||||
- name: stat the link target
|
||||
stat: path={{output_dir}}/test_follow
|
||||
register: result
|
||||
|
||||
- name: assert that the link target was modified correctly
|
||||
assert:
|
||||
that:
|
||||
- result.stat.mode == '0644'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue