Debian Codegraph @

test/integration/targets/file/tasks/link_follow.yml

raw
1 - name: Ensure output_dir
2 file:
3 path: "{{output_dir}}"
4 state: directory
5
6 - name: Touch a file in it
7 file:
8 path: "{{output_dir}}/original.txt"
9 state: touch
10
11 - name: Create a symlink
12 file:
13 src: "{{output_dir}}/original.txt"
14 dest: "{{output_dir}}/soft.txt"
15 state: link
16
17 - name: Create an hard link with follow to the sym link
18 file:
19 src: "{{output_dir}}/soft.txt"
20 dest: "{{output_dir}}/hard.txt"
21 state: hard
22 follow: yes
23
24 - name: Create a symlink from another symlink
25 file:
26 src: "{{output_dir}}/soft.txt"
27 dest: "{{output_dir}}/soft2.txt"
28 follow: yes
29 state: link
30
31 - name: Hard link stat
32 stat:
33 path: "{{output_dir}}/hard.txt"
34 register: hard_stat
35
36 - name: Soft link stat
37 stat:
38 path: "{{output_dir}}/soft2.txt"
39 register: soft_stat
40
41 - name: Check link status
42 assert:
43 that:
44 - "hard_stat.stat.exists == true"
45 - "soft_stat.stat.exists == true"