summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/omit/C75692.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
commit8a754e0858d922e955e71b253c139e071ecec432 (patch)
tree527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/omit/C75692.yml
parentInitial commit. (diff)
downloadansible-core-upstream.tar.xz
ansible-core-upstream.zip
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/omit/C75692.yml')
-rw-r--r--test/integration/targets/omit/C75692.yml44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/integration/targets/omit/C75692.yml b/test/integration/targets/omit/C75692.yml
new file mode 100644
index 0000000..6e1215f
--- /dev/null
+++ b/test/integration/targets/omit/C75692.yml
@@ -0,0 +1,44 @@
+- hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: Make sure foo is gone
+ file:
+ path: foo
+ state: absent
+ - name: Create foo - should only be changed in first iteration
+ copy:
+ dest: foo
+ content: foo
+ check_mode: '{{ omit }}'
+ register: cmode
+ loop:
+ - 1
+ - 2
+
+ - when: ansible_check_mode
+ block:
+ - name: stat foo
+ stat: path=foo
+ register: foo
+ check_mode: off
+ - debug: var=foo
+ - name: validate expected outcomes when in check mode and file does not exist
+ assert:
+ that:
+ - cmode['results'][0] is changed
+ - cmode['results'][1] is changed
+ when: not foo['stat']['exists']
+
+ - name: validate expected outcomes when in check mode and file exists
+ assert:
+ that:
+ - cmode['results'][0] is not changed
+ - cmode['results'][1] is not changed
+ when: foo['stat']['exists']
+
+ - name: validate expected outcomes when not in check mode (file is always deleted)
+ assert:
+ that:
+ - cmode['results'][0] is changed
+ - cmode['results'][1] is not changed
+ when: not ansible_check_mode