Skip to content

Commit

Permalink
sysctl: Fixed sysctl to work on symlinks(ansible-collections#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
satken2 committed Jun 11, 2021
1 parent a488709 commit 34b4677
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions tests/integration/targets/sysctl/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,36 +310,3 @@
that:
- sysctl_invalid_set1 is failed
- "'vm.mmap_rnd_bits' not in sysctl_invalid_conf_content.stdout"

# Test sysctl: sysctl_file is symlink
- name: Create link source
copy:
content: |
# Testing Ansible Sysctl module on symlink.
dest: /tmp/ansible_sysctl_test.conf

- name: Create symlink to the conf file
file:
src: /tmp/ansible_sysctl_test.conf
dest: /tmp/ansible_sysctl_test_symlink.conf
state: link

- name: Use sysctl module with symlink sysctl file
sysctl:
name: 'kernel.randomize_va_space'
value: '1'
sysctl_file: /tmp/ansible_sysctl_test_symlink.conf
state: present
sysctl_set: false
reload: false

- name: Stat sysctl file
stat:
path: /tmp/ansible_sysctl_test_symlink.conf
register: stat_result

- name: Ensure the sysctl file remains a symlink
assert:
that:
- stat_result.stat.islnk is defined and stat_result.stat.islnk
- stat_result.stat.lnk_source == /tmp/ansible_sysctl_test.conf

0 comments on commit 34b4677

Please sign in to comment.