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:
James Cammarata 2014-09-16 12:03:40 -05:00
commit b376e208c7
7 changed files with 96 additions and 13 deletions

View file

@ -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'