File: link_rewrite.yml

package info (click to toggle)
ansible-core 2.19.0~beta6-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,628 kB
  • sloc: python: 180,313; cs: 4,929; sh: 4,601; xml: 34; makefile: 21
file content (47 lines) | stat: -rw-r--r-- 891 bytes parent folder | download | duplicates (2)
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'"