File: diff.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 (44 lines) | stat: -rw-r--r-- 948 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
# file module tests for diff being returned in results

- name: Initialize the test output dir
  import_tasks: initialize.yml

- name: Create an empty file
  file:
    state: touch
    mode: "755"
    path: "{{ remote_tmp_dir_test }}/foobar.txt"
  register: temp_file

- name: Confirm diff was not returned in results
  assert:
    that:
      - temp_file.diff is not defined

- name: Toggle permissions on said empty file
  file:
    state: file
    mode: "644"
    path: "{{ temp_file.dest }}"
  register: temp_file
  diff: true

- name: Confirm diff was returned in results
  assert:
    that:
      - temp_file.diff is defined

- name: Toggle permissions on said empty file...again
  file:
    state: file
    mode: "755"
    path: "{{ temp_file.path }}"
  register: temp_file
  diff: false
  environment:
    ANSIBLE_DIFF_ALWAYS: True

- name: Confirm diff was not returned in results
  assert:
    that:
      - temp_file.diff is not defined