summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/file/tasks/link_rewrite.yml
blob: b0e1af3ec2118fbc0e9efcf19d10a1f846dabba6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
- name: create temporary build directory
  tempfile:
    state: directory
    suffix: ansible_test_leave_links_alone_during_touch
  register: tempdir

- name: create file
  copy:
    mode: 0600
    content: "chicken"
    dest: "{{ tempdir.path }}/somefile"

- name: Create relative link
  file:
    src: somefile
    dest: "{{ tempdir.path }}/somelink"
    state: link

- stat: 
    path: "{{ tempdir.path }}/somelink"
  register: link

- stat: 
    path: "{{ tempdir.path }}/somefile"
  register: file

- assert:
    that:
    - "file.stat.mode == '0600'"
    - "link.stat.lnk_target == 'somefile'"

- file:
    path: "{{ tempdir.path }}/somelink"
    mode: 0644
    
- stat: 
    path: "{{ tempdir.path }}/somelink"
  register: link

- stat: 
    path: "{{ tempdir.path }}/somefile"
  register: file

- assert:
    that:
    - "file.stat.mode == '0644'"
    - "link.stat.lnk_target == 'somefile'"