summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/callback_default
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:03:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:03:01 +0000
commita453ac31f3428614cceb99027f8efbdb9258a40b (patch)
treef61f87408f32a8511cbd91799f9cececb53e0374 /test/integration/targets/callback_default
parentInitial commit. (diff)
downloadansible-upstream.tar.xz
ansible-upstream.zip
Adding upstream version 2.10.7+merged+base+2.10.8+dfsg.upstream/2.10.7+merged+base+2.10.8+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/callback_default')
-rw-r--r--test/integration/targets/callback_default/aliases2
-rw-r--r--test/integration/targets/callback_default/callback_default.out.check_markers_dry.stderr2
-rw-r--r--test/integration/targets/callback_default/callback_default.out.check_markers_dry.stdout78
-rw-r--r--test/integration/targets/callback_default/callback_default.out.check_markers_wet.stderr2
-rw-r--r--test/integration/targets/callback_default/callback_default.out.check_markers_wet.stdout74
-rw-r--r--test/integration/targets/callback_default/callback_default.out.check_nomarkers_dry.stderr2
-rw-r--r--test/integration/targets/callback_default/callback_default.out.check_nomarkers_dry.stdout74
-rw-r--r--test/integration/targets/callback_default/callback_default.out.check_nomarkers_wet.stderr2
-rw-r--r--test/integration/targets/callback_default/callback_default.out.check_nomarkers_wet.stdout74
-rw-r--r--test/integration/targets/callback_default/callback_default.out.default.stderr2
-rw-r--r--test/integration/targets/callback_default/callback_default.out.default.stdout72
-rw-r--r--test/integration/targets/callback_default/callback_default.out.failed_to_stderr.stderr5
-rw-r--r--test/integration/targets/callback_default/callback_default.out.failed_to_stderr.stdout69
-rw-r--r--test/integration/targets/callback_default/callback_default.out.free.stdout35
-rw-r--r--test/integration/targets/callback_default/callback_default.out.hide_ok.stderr2
-rw-r--r--test/integration/targets/callback_default/callback_default.out.hide_ok.stdout56
-rw-r--r--test/integration/targets/callback_default/callback_default.out.hide_skipped.stderr2
-rw-r--r--test/integration/targets/callback_default/callback_default.out.hide_skipped.stdout66
-rw-r--r--test/integration/targets/callback_default/callback_default.out.hide_skipped_ok.stderr2
-rw-r--r--test/integration/targets/callback_default/callback_default.out.hide_skipped_ok.stdout52
-rw-r--r--test/integration/targets/callback_default/callback_default.out.host_pinned.stdout35
-rw-r--r--test/integration/targets/callback_default/include_me.yml2
-rw-r--r--test/integration/targets/callback_default/inventory10
-rwxr-xr-xtest/integration/targets/callback_default/runme.sh190
-rw-r--r--test/integration/targets/callback_default/test.yml88
-rw-r--r--test/integration/targets/callback_default/test_2.yml6
-rw-r--r--test/integration/targets/callback_default/test_dryrun.yml93
-rw-r--r--test/integration/targets/callback_default/test_non_lockstep.yml7
28 files changed, 1104 insertions, 0 deletions
diff --git a/test/integration/targets/callback_default/aliases b/test/integration/targets/callback_default/aliases
new file mode 100644
index 00000000..f8e28c7e
--- /dev/null
+++ b/test/integration/targets/callback_default/aliases
@@ -0,0 +1,2 @@
+shippable/posix/group1
+skip/aix
diff --git a/test/integration/targets/callback_default/callback_default.out.check_markers_dry.stderr b/test/integration/targets/callback_default/callback_default.out.check_markers_dry.stderr
new file mode 100644
index 00000000..431a0200
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.check_markers_dry.stderr
@@ -0,0 +1,2 @@
++ ansible-playbook -i inventory --check test_dryrun.yml
+++ set +x
diff --git a/test/integration/targets/callback_default/callback_default.out.check_markers_dry.stdout b/test/integration/targets/callback_default/callback_default.out.check_markers_dry.stdout
new file mode 100644
index 00000000..8a349097
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.check_markers_dry.stdout
@@ -0,0 +1,78 @@
+
+DRY RUN ************************************************************************
+
+PLAY [A common play] [CHECK MODE] **********************************************
+
+TASK [debug] [CHECK MODE] ******************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: True"
+}
+
+TASK [Command] [CHECK MODE] ****************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY [Play with check_mode: true (runs always in check_mode)] [CHECK MODE] *****
+
+TASK [debug] [CHECK MODE] ******************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: True"
+}
+
+TASK [Command] [CHECK MODE] ****************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY [Play with check_mode: false (runs always in wet mode)] *******************
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: True"
+}
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY [Play with a block with check_mode: true] [CHECK MODE] ********************
+
+TASK [Command] [CHECK MODE] ****************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY [Play with a block with check_mode: false] [CHECK MODE] *******************
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY RECAP *********************************************************************
+testhost : ok=10 changed=7 unreachable=0 failed=0 skipped=8 rescued=0 ignored=0
+
+
+DRY RUN ************************************************************************
diff --git a/test/integration/targets/callback_default/callback_default.out.check_markers_wet.stderr b/test/integration/targets/callback_default/callback_default.out.check_markers_wet.stderr
new file mode 100644
index 00000000..e4309428
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.check_markers_wet.stderr
@@ -0,0 +1,2 @@
++ ansible-playbook -i inventory test_dryrun.yml
+++ set +x
diff --git a/test/integration/targets/callback_default/callback_default.out.check_markers_wet.stdout b/test/integration/targets/callback_default/callback_default.out.check_markers_wet.stdout
new file mode 100644
index 00000000..f5f45105
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.check_markers_wet.stdout
@@ -0,0 +1,74 @@
+
+PLAY [A common play] ***********************************************************
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: False"
+}
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY [Play with check_mode: true (runs always in check_mode)] [CHECK MODE] *****
+
+TASK [debug] [CHECK MODE] ******************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: False"
+}
+
+TASK [Command] [CHECK MODE] ****************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY [Play with check_mode: false (runs always in wet mode)] *******************
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: False"
+}
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY [Play with a block with check_mode: true] *********************************
+
+TASK [Command] [CHECK MODE] ****************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY [Play with a block with check_mode: false] ********************************
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] [CHECK MODE] ******************************
+skipping: [testhost]
+
+PLAY RECAP *********************************************************************
+testhost : ok=11 changed=8 unreachable=0 failed=0 skipped=7 rescued=0 ignored=0
+
diff --git a/test/integration/targets/callback_default/callback_default.out.check_nomarkers_dry.stderr b/test/integration/targets/callback_default/callback_default.out.check_nomarkers_dry.stderr
new file mode 100644
index 00000000..431a0200
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.check_nomarkers_dry.stderr
@@ -0,0 +1,2 @@
++ ansible-playbook -i inventory --check test_dryrun.yml
+++ set +x
diff --git a/test/integration/targets/callback_default/callback_default.out.check_nomarkers_dry.stdout b/test/integration/targets/callback_default/callback_default.out.check_nomarkers_dry.stdout
new file mode 100644
index 00000000..e984d499
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.check_nomarkers_dry.stdout
@@ -0,0 +1,74 @@
+
+PLAY [A common play] ***********************************************************
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: True"
+}
+
+TASK [Command] *****************************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY [Play with check_mode: true (runs always in check_mode)] ******************
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: True"
+}
+
+TASK [Command] *****************************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY [Play with check_mode: false (runs always in wet mode)] *******************
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: True"
+}
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY [Play with a block with check_mode: true] *********************************
+
+TASK [Command] *****************************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY [Play with a block with check_mode: false] ********************************
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY RECAP *********************************************************************
+testhost : ok=10 changed=7 unreachable=0 failed=0 skipped=8 rescued=0 ignored=0
+
diff --git a/test/integration/targets/callback_default/callback_default.out.check_nomarkers_wet.stderr b/test/integration/targets/callback_default/callback_default.out.check_nomarkers_wet.stderr
new file mode 100644
index 00000000..e4309428
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.check_nomarkers_wet.stderr
@@ -0,0 +1,2 @@
++ ansible-playbook -i inventory test_dryrun.yml
+++ set +x
diff --git a/test/integration/targets/callback_default/callback_default.out.check_nomarkers_wet.stdout b/test/integration/targets/callback_default/callback_default.out.check_nomarkers_wet.stdout
new file mode 100644
index 00000000..2b331bb8
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.check_nomarkers_wet.stdout
@@ -0,0 +1,74 @@
+
+PLAY [A common play] ***********************************************************
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: False"
+}
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY [Play with check_mode: true (runs always in check_mode)] ******************
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: False"
+}
+
+TASK [Command] *****************************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY [Play with check_mode: false (runs always in wet mode)] *******************
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "msg": "ansible_check_mode: False"
+}
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY [Play with a block with check_mode: true] *********************************
+
+TASK [Command] *****************************************************************
+skipping: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY [Play with a block with check_mode: false] ********************************
+
+TASK [Command] *****************************************************************
+changed: [testhost]
+
+TASK [Command with check_mode: false] ******************************************
+changed: [testhost]
+
+TASK [Command with check_mode: true] *******************************************
+skipping: [testhost]
+
+PLAY RECAP *********************************************************************
+testhost : ok=11 changed=8 unreachable=0 failed=0 skipped=7 rescued=0 ignored=0
+
diff --git a/test/integration/targets/callback_default/callback_default.out.default.stderr b/test/integration/targets/callback_default/callback_default.out.default.stderr
new file mode 100644
index 00000000..d3e07d47
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.default.stderr
@@ -0,0 +1,2 @@
++ ansible-playbook -i inventory test.yml
+++ set +x
diff --git a/test/integration/targets/callback_default/callback_default.out.default.stdout b/test/integration/targets/callback_default/callback_default.out.default.stdout
new file mode 100644
index 00000000..05f90beb
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.default.stdout
@@ -0,0 +1,72 @@
+
+PLAY [testhost] ****************************************************************
+
+TASK [Changed task] ************************************************************
+changed: [testhost]
+
+TASK [Ok task] *****************************************************************
+ok: [testhost]
+
+TASK [Failed task] *************************************************************
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"}
+...ignoring
+
+TASK [Skipped task] ************************************************************
+skipping: [testhost]
+
+TASK [Task with var in name (foo bar)] *****************************************
+changed: [testhost]
+
+TASK [Loop task] ***************************************************************
+changed: [testhost] => (item=foo-1)
+changed: [testhost] => (item=foo-2)
+changed: [testhost] => (item=foo-3)
+
+TASK [debug loop] **************************************************************
+changed: [testhost] => (item=debug-1) => {
+ "msg": "debug-1"
+}
+failed: [testhost] (item=debug-2) => {
+ "msg": "debug-2"
+}
+ok: [testhost] => (item=debug-3) => {
+ "msg": "debug-3"
+}
+skipping: [testhost] => (item=debug-4)
+fatal: [testhost]: FAILED! => {"msg": "All items completed"}
+...ignoring
+
+TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
+
+TASK [Rescue task] *************************************************************
+changed: [testhost]
+
+TASK [include_tasks] ***********************************************************
+included: .../test/integration/targets/callback_default/include_me.yml for testhost => (item=1)
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "item": 1
+}
+
+RUNNING HANDLER [Test handler 1] ***********************************************
+changed: [testhost]
+
+RUNNING HANDLER [Test handler 2] ***********************************************
+ok: [testhost]
+
+RUNNING HANDLER [Test handler 3] ***********************************************
+changed: [testhost]
+
+PLAY [testhost] ****************************************************************
+
+TASK [First free task] *********************************************************
+changed: [testhost]
+
+TASK [Second free task] ********************************************************
+changed: [testhost]
+
+PLAY RECAP *********************************************************************
+testhost : ok=14 changed=9 unreachable=0 failed=0 skipped=1 rescued=1 ignored=2
+
diff --git a/test/integration/targets/callback_default/callback_default.out.failed_to_stderr.stderr b/test/integration/targets/callback_default/callback_default.out.failed_to_stderr.stderr
new file mode 100644
index 00000000..932a2e4f
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.failed_to_stderr.stderr
@@ -0,0 +1,5 @@
++ ansible-playbook -i inventory test.yml
+++ set +x
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"}
+fatal: [testhost]: FAILED! => {"msg": "All items completed"}
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
diff --git a/test/integration/targets/callback_default/callback_default.out.failed_to_stderr.stdout b/test/integration/targets/callback_default/callback_default.out.failed_to_stderr.stdout
new file mode 100644
index 00000000..fe990d42
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.failed_to_stderr.stdout
@@ -0,0 +1,69 @@
+
+PLAY [testhost] ****************************************************************
+
+TASK [Changed task] ************************************************************
+changed: [testhost]
+
+TASK [Ok task] *****************************************************************
+ok: [testhost]
+
+TASK [Failed task] *************************************************************
+...ignoring
+
+TASK [Skipped task] ************************************************************
+skipping: [testhost]
+
+TASK [Task with var in name (foo bar)] *****************************************
+changed: [testhost]
+
+TASK [Loop task] ***************************************************************
+changed: [testhost] => (item=foo-1)
+changed: [testhost] => (item=foo-2)
+changed: [testhost] => (item=foo-3)
+
+TASK [debug loop] **************************************************************
+changed: [testhost] => (item=debug-1) => {
+ "msg": "debug-1"
+}
+failed: [testhost] (item=debug-2) => {
+ "msg": "debug-2"
+}
+ok: [testhost] => (item=debug-3) => {
+ "msg": "debug-3"
+}
+skipping: [testhost] => (item=debug-4)
+...ignoring
+
+TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
+
+TASK [Rescue task] *************************************************************
+changed: [testhost]
+
+TASK [include_tasks] ***********************************************************
+included: .../test/integration/targets/callback_default/include_me.yml for testhost => (item=1)
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "item": 1
+}
+
+RUNNING HANDLER [Test handler 1] ***********************************************
+changed: [testhost]
+
+RUNNING HANDLER [Test handler 2] ***********************************************
+ok: [testhost]
+
+RUNNING HANDLER [Test handler 3] ***********************************************
+changed: [testhost]
+
+PLAY [testhost] ****************************************************************
+
+TASK [First free task] *********************************************************
+changed: [testhost]
+
+TASK [Second free task] ********************************************************
+changed: [testhost]
+
+PLAY RECAP *********************************************************************
+testhost : ok=14 changed=9 unreachable=0 failed=0 skipped=1 rescued=1 ignored=2
+
diff --git a/test/integration/targets/callback_default/callback_default.out.free.stdout b/test/integration/targets/callback_default/callback_default.out.free.stdout
new file mode 100644
index 00000000..0ec04479
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.free.stdout
@@ -0,0 +1,35 @@
+
+PLAY [nonlockstep] *************************************************************
+
+TASK [command] *****************************************************************
+changed: [testhost10]
+
+TASK [command] *****************************************************************
+changed: [testhost10]
+
+TASK [command] *****************************************************************
+changed: [testhost10]
+
+TASK [command] *****************************************************************
+changed: [testhost11]
+
+TASK [command] *****************************************************************
+changed: [testhost11]
+
+TASK [command] *****************************************************************
+changed: [testhost11]
+
+TASK [command] *****************************************************************
+changed: [testhost12]
+
+TASK [command] *****************************************************************
+changed: [testhost12]
+
+TASK [command] *****************************************************************
+changed: [testhost12]
+
+PLAY RECAP *********************************************************************
+testhost10 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
+testhost11 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
+testhost12 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
+
diff --git a/test/integration/targets/callback_default/callback_default.out.hide_ok.stderr b/test/integration/targets/callback_default/callback_default.out.hide_ok.stderr
new file mode 100644
index 00000000..d3e07d47
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.hide_ok.stderr
@@ -0,0 +1,2 @@
++ ansible-playbook -i inventory test.yml
+++ set +x
diff --git a/test/integration/targets/callback_default/callback_default.out.hide_ok.stdout b/test/integration/targets/callback_default/callback_default.out.hide_ok.stdout
new file mode 100644
index 00000000..c1e1846b
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.hide_ok.stdout
@@ -0,0 +1,56 @@
+
+PLAY [testhost] ****************************************************************
+
+TASK [Changed task] ************************************************************
+changed: [testhost]
+
+TASK [Failed task] *************************************************************
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"}
+...ignoring
+
+TASK [Skipped task] ************************************************************
+skipping: [testhost]
+
+TASK [Task with var in name (foo bar)] *****************************************
+changed: [testhost]
+
+TASK [Loop task] ***************************************************************
+changed: [testhost] => (item=foo-1)
+changed: [testhost] => (item=foo-2)
+changed: [testhost] => (item=foo-3)
+
+TASK [debug loop] **************************************************************
+changed: [testhost] => (item=debug-1) => {
+ "msg": "debug-1"
+}
+failed: [testhost] (item=debug-2) => {
+ "msg": "debug-2"
+}
+skipping: [testhost] => (item=debug-4)
+fatal: [testhost]: FAILED! => {"msg": "All items completed"}
+...ignoring
+
+TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
+
+TASK [Rescue task] *************************************************************
+changed: [testhost]
+included: .../test/integration/targets/callback_default/include_me.yml for testhost => (item=1)
+
+RUNNING HANDLER [Test handler 1] ***********************************************
+changed: [testhost]
+
+RUNNING HANDLER [Test handler 3] ***********************************************
+changed: [testhost]
+
+PLAY [testhost] ****************************************************************
+
+TASK [First free task] *********************************************************
+changed: [testhost]
+
+TASK [Second free task] ********************************************************
+changed: [testhost]
+
+PLAY RECAP *********************************************************************
+testhost : ok=14 changed=9 unreachable=0 failed=0 skipped=1 rescued=1 ignored=2
+
diff --git a/test/integration/targets/callback_default/callback_default.out.hide_skipped.stderr b/test/integration/targets/callback_default/callback_default.out.hide_skipped.stderr
new file mode 100644
index 00000000..d3e07d47
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.hide_skipped.stderr
@@ -0,0 +1,2 @@
++ ansible-playbook -i inventory test.yml
+++ set +x
diff --git a/test/integration/targets/callback_default/callback_default.out.hide_skipped.stdout b/test/integration/targets/callback_default/callback_default.out.hide_skipped.stdout
new file mode 100644
index 00000000..660c7285
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.hide_skipped.stdout
@@ -0,0 +1,66 @@
+
+PLAY [testhost] ****************************************************************
+
+TASK [Changed task] ************************************************************
+changed: [testhost]
+
+TASK [Ok task] *****************************************************************
+ok: [testhost]
+
+TASK [Failed task] *************************************************************
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"}
+...ignoring
+
+TASK [Task with var in name (foo bar)] *****************************************
+changed: [testhost]
+
+TASK [Loop task] ***************************************************************
+changed: [testhost] => (item=foo-1)
+changed: [testhost] => (item=foo-2)
+changed: [testhost] => (item=foo-3)
+
+TASK [debug loop] **************************************************************
+changed: [testhost] => (item=debug-1) => {
+ "msg": "debug-1"
+}
+failed: [testhost] (item=debug-2) => {
+ "msg": "debug-2"
+}
+ok: [testhost] => (item=debug-3) => {
+ "msg": "debug-3"
+}
+fatal: [testhost]: FAILED! => {"msg": "All items completed"}
+...ignoring
+
+TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
+
+TASK [Rescue task] *************************************************************
+changed: [testhost]
+included: .../test/integration/targets/callback_default/include_me.yml for testhost => (item=1)
+
+TASK [debug] *******************************************************************
+ok: [testhost] => {
+ "item": 1
+}
+
+RUNNING HANDLER [Test handler 1] ***********************************************
+changed: [testhost]
+
+RUNNING HANDLER [Test handler 2] ***********************************************
+ok: [testhost]
+
+RUNNING HANDLER [Test handler 3] ***********************************************
+changed: [testhost]
+
+PLAY [testhost] ****************************************************************
+
+TASK [First free task] *********************************************************
+changed: [testhost]
+
+TASK [Second free task] ********************************************************
+changed: [testhost]
+
+PLAY RECAP *********************************************************************
+testhost : ok=14 changed=9 unreachable=0 failed=0 skipped=1 rescued=1 ignored=2
+
diff --git a/test/integration/targets/callback_default/callback_default.out.hide_skipped_ok.stderr b/test/integration/targets/callback_default/callback_default.out.hide_skipped_ok.stderr
new file mode 100644
index 00000000..d3e07d47
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.hide_skipped_ok.stderr
@@ -0,0 +1,2 @@
++ ansible-playbook -i inventory test.yml
+++ set +x
diff --git a/test/integration/targets/callback_default/callback_default.out.hide_skipped_ok.stdout b/test/integration/targets/callback_default/callback_default.out.hide_skipped_ok.stdout
new file mode 100644
index 00000000..13948b9f
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.hide_skipped_ok.stdout
@@ -0,0 +1,52 @@
+
+PLAY [testhost] ****************************************************************
+
+TASK [Changed task] ************************************************************
+changed: [testhost]
+
+TASK [Failed task] *************************************************************
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"}
+...ignoring
+
+TASK [Task with var in name (foo bar)] *****************************************
+changed: [testhost]
+
+TASK [Loop task] ***************************************************************
+changed: [testhost] => (item=foo-1)
+changed: [testhost] => (item=foo-2)
+changed: [testhost] => (item=foo-3)
+
+TASK [debug loop] **************************************************************
+changed: [testhost] => (item=debug-1) => {
+ "msg": "debug-1"
+}
+failed: [testhost] (item=debug-2) => {
+ "msg": "debug-2"
+}
+fatal: [testhost]: FAILED! => {"msg": "All items completed"}
+...ignoring
+
+TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
+fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
+
+TASK [Rescue task] *************************************************************
+changed: [testhost]
+included: .../test/integration/targets/callback_default/include_me.yml for testhost => (item=1)
+
+RUNNING HANDLER [Test handler 1] ***********************************************
+changed: [testhost]
+
+RUNNING HANDLER [Test handler 3] ***********************************************
+changed: [testhost]
+
+PLAY [testhost] ****************************************************************
+
+TASK [First free task] *********************************************************
+changed: [testhost]
+
+TASK [Second free task] ********************************************************
+changed: [testhost]
+
+PLAY RECAP *********************************************************************
+testhost : ok=14 changed=9 unreachable=0 failed=0 skipped=1 rescued=1 ignored=2
+
diff --git a/test/integration/targets/callback_default/callback_default.out.host_pinned.stdout b/test/integration/targets/callback_default/callback_default.out.host_pinned.stdout
new file mode 100644
index 00000000..0ec04479
--- /dev/null
+++ b/test/integration/targets/callback_default/callback_default.out.host_pinned.stdout
@@ -0,0 +1,35 @@
+
+PLAY [nonlockstep] *************************************************************
+
+TASK [command] *****************************************************************
+changed: [testhost10]
+
+TASK [command] *****************************************************************
+changed: [testhost10]
+
+TASK [command] *****************************************************************
+changed: [testhost10]
+
+TASK [command] *****************************************************************
+changed: [testhost11]
+
+TASK [command] *****************************************************************
+changed: [testhost11]
+
+TASK [command] *****************************************************************
+changed: [testhost11]
+
+TASK [command] *****************************************************************
+changed: [testhost12]
+
+TASK [command] *****************************************************************
+changed: [testhost12]
+
+TASK [command] *****************************************************************
+changed: [testhost12]
+
+PLAY RECAP *********************************************************************
+testhost10 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
+testhost11 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
+testhost12 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
+
diff --git a/test/integration/targets/callback_default/include_me.yml b/test/integration/targets/callback_default/include_me.yml
new file mode 100644
index 00000000..51470f3c
--- /dev/null
+++ b/test/integration/targets/callback_default/include_me.yml
@@ -0,0 +1,2 @@
+- debug:
+ var: item
diff --git a/test/integration/targets/callback_default/inventory b/test/integration/targets/callback_default/inventory
new file mode 100644
index 00000000..6d9b3028
--- /dev/null
+++ b/test/integration/targets/callback_default/inventory
@@ -0,0 +1,10 @@
+[local]
+testhost ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
+
+[nonexistent]
+testhost5 ansible_host=169.254.199.200 # no connection is ever established with this host
+
+[nonlockstep]
+testhost10 i=0.5 ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
+testhost11 i=3.0 ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
+testhost12 i=12.0 ansible_connection=local ansible_python_interpreter="{{ ansible_playbook_python }}"
diff --git a/test/integration/targets/callback_default/runme.sh b/test/integration/targets/callback_default/runme.sh
new file mode 100755
index 00000000..a8033d7d
--- /dev/null
+++ b/test/integration/targets/callback_default/runme.sh
@@ -0,0 +1,190 @@
+#!/usr/bin/env bash
+
+# This test compares "known good" output with various settings against output
+# with the current code. It's brittle by nature, but this is probably the
+# "best" approach possible.
+#
+# Notes:
+# * options passed to this script (such as -v) are ignored, as they would change
+# the output and break the test
+# * the number of asterisks after a "banner" differs depending on the number of
+# columns on the TTY, so we must adjust the columns for the current session
+# for consistency
+
+set -eux
+
+run_test() {
+ local testname=$1
+
+ # outout was recorded w/o cowsay, ensure we reproduce the same
+ export ANSIBLE_NOCOWS=1
+
+ # The shenanigans with redirection and 'tee' are to capture STDOUT and
+ # STDERR separately while still displaying both to the console
+ { ansible-playbook -i inventory test.yml \
+ > >(set +x; tee "${OUTFILE}.${testname}.stdout"); } \
+ 2> >(set +x; tee "${OUTFILE}.${testname}.stderr" >&2)
+ # Scrub deprication warning that shows up in Python 2.6 on CentOS 6
+ sed -i -e '/RandomPool_DeprecationWarning/d' "${OUTFILE}.${testname}.stderr"
+ sed -i -e 's/included: .*\/test\/integration/included: ...\/test\/integration/g' "${OUTFILE}.${testname}.stdout"
+
+ diff -u "${ORIGFILE}.${testname}.stdout" "${OUTFILE}.${testname}.stdout" || diff_failure
+ diff -u "${ORIGFILE}.${testname}.stderr" "${OUTFILE}.${testname}.stderr" || diff_failure
+}
+
+run_test_dryrun() {
+ local testname=$1
+ # optional, pass --check to run a dry run
+ local chk=${2:-}
+
+ # outout was recorded w/o cowsay, ensure we reproduce the same
+ export ANSIBLE_NOCOWS=1
+
+ # This needed to satisfy shellcheck that can not accept unquoted variable
+ cmd="ansible-playbook -i inventory ${chk} test_dryrun.yml"
+
+ # The shenanigans with redirection and 'tee' are to capture STDOUT and
+ # STDERR separately while still displaying both to the console
+ { $cmd \
+ > >(set +x; tee "${OUTFILE}.${testname}.stdout"); } \
+ 2> >(set +x; tee "${OUTFILE}.${testname}.stderr" >&2)
+ # Scrub deprication warning that shows up in Python 2.6 on CentOS 6
+ sed -i -e '/RandomPool_DeprecationWarning/d' "${OUTFILE}.${testname}.stderr"
+
+ diff -u "${ORIGFILE}.${testname}.stdout" "${OUTFILE}.${testname}.stdout" || diff_failure
+ diff -u "${ORIGFILE}.${testname}.stderr" "${OUTFILE}.${testname}.stderr" || diff_failure
+}
+
+diff_failure() {
+ if [[ $INIT = 0 ]]; then
+ echo "FAILURE...diff mismatch!"
+ exit 1
+ fi
+}
+
+cleanup() {
+ if [[ $INIT = 0 ]]; then
+ rm -rf "${OUTFILE}.*"
+ fi
+
+ if [[ -f "${BASEFILE}.unreachable.stdout" ]]; then
+ rm -rf "${BASEFILE}.unreachable.stdout"
+ fi
+
+ if [[ -f "${BASEFILE}.unreachable.stderr" ]]; then
+ rm -rf "${BASEFILE}.unreachable.stderr"
+ fi
+
+ # Restore TTY cols
+ if [[ -n ${TTY_COLS:-} ]]; then
+ stty cols "${TTY_COLS}"
+ fi
+}
+
+adjust_tty_cols() {
+ if [[ -t 1 ]]; then
+ # Preserve existing TTY cols
+ TTY_COLS=$( stty -a | grep -Eo '; columns [0-9]+;' | cut -d';' -f2 | cut -d' ' -f3 )
+ # Override TTY cols to make comparing ansible-playbook output easier
+ # This value matches the default in the code when there is no TTY
+ stty cols 79
+ fi
+}
+
+BASEFILE=callback_default.out
+
+ORIGFILE="${BASEFILE}"
+OUTFILE="${BASEFILE}.new"
+
+trap 'cleanup' EXIT
+
+# The --init flag will (re)generate the "good" output files used by the tests
+INIT=0
+if [[ ${1:-} == "--init" ]]; then
+ shift
+ OUTFILE=$ORIGFILE
+ INIT=1
+fi
+
+adjust_tty_cols
+
+# Force the 'default' callback plugin, since that's what we're testing
+export ANSIBLE_STDOUT_CALLBACK=default
+# Disable color in output for consistency
+export ANSIBLE_FORCE_COLOR=0
+export ANSIBLE_NOCOLOR=1
+
+# Default settings
+export ANSIBLE_DISPLAY_SKIPPED_HOSTS=1
+export ANSIBLE_DISPLAY_OK_HOSTS=1
+export ANSIBLE_DISPLAY_FAILED_STDERR=0
+export ANSIBLE_CHECK_MODE_MARKERS=0
+
+run_test default
+
+# Hide skipped
+export ANSIBLE_DISPLAY_SKIPPED_HOSTS=0
+
+run_test hide_skipped
+
+# Hide skipped/ok
+export ANSIBLE_DISPLAY_SKIPPED_HOSTS=0
+export ANSIBLE_DISPLAY_OK_HOSTS=0
+
+run_test hide_skipped_ok
+
+# Hide ok
+export ANSIBLE_DISPLAY_SKIPPED_HOSTS=1
+export ANSIBLE_DISPLAY_OK_HOSTS=0
+
+run_test hide_ok
+
+# Failed to stderr
+export ANSIBLE_DISPLAY_SKIPPED_HOSTS=1
+export ANSIBLE_DISPLAY_OK_HOSTS=1
+export ANSIBLE_DISPLAY_FAILED_STDERR=1
+
+run_test failed_to_stderr
+
+# Default settings with unreachable tasks
+export ANSIBLE_DISPLAY_SKIPPED_HOSTS=1
+export ANSIBLE_DISPLAY_OK_HOSTS=1
+export ANSIBLE_DISPLAY_FAILED_STDERR=1
+export ANSIBLE_TIMEOUT=1
+
+# Check if UNREACHBLE is available in stderr
+set +e
+ansible-playbook -i inventory test_2.yml > >(set +x; tee "${BASEFILE}.unreachable.stdout";) 2> >(set +x; tee "${BASEFILE}.unreachable.stderr" >&2) || true
+set -e
+if test "$(grep -c 'UNREACHABLE' "${BASEFILE}.unreachable.stderr")" -ne 1; then
+ echo "Test failed"
+ exit 1
+fi
+
+## DRY RUN tests
+#
+# Default settings with dry run tasks
+export ANSIBLE_DISPLAY_SKIPPED_HOSTS=1
+export ANSIBLE_DISPLAY_OK_HOSTS=1
+export ANSIBLE_DISPLAY_FAILED_STDERR=1
+# Enable Check mode markers
+export ANSIBLE_CHECK_MODE_MARKERS=1
+
+# Test the wet run with check markers
+run_test_dryrun check_markers_wet
+
+# Test the dry run with check markers
+run_test_dryrun check_markers_dry --check
+
+# Disable Check mode markers
+export ANSIBLE_CHECK_MODE_MARKERS=0
+
+# Test the wet run without check markers
+run_test_dryrun check_nomarkers_wet
+
+# Test the dry run without check markers
+run_test_dryrun check_nomarkers_dry --check
+
+# Ensure free/host_pinned non-lockstep strategies display correctly
+diff -u callback_default.out.free.stdout <(ANSIBLE_STRATEGY=free ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null)
+diff -u callback_default.out.host_pinned.stdout <(ANSIBLE_STRATEGY=host_pinned ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null)
diff --git a/test/integration/targets/callback_default/test.yml b/test/integration/targets/callback_default/test.yml
new file mode 100644
index 00000000..b31787bf
--- /dev/null
+++ b/test/integration/targets/callback_default/test.yml
@@ -0,0 +1,88 @@
+---
+- hosts: testhost
+ gather_facts: no
+ vars:
+ foo: foo bar
+ tasks:
+ - name: Changed task
+ command: echo foo
+ changed_when: true
+ notify: test handlers
+
+ - name: Ok task
+ command: echo foo
+ changed_when: false
+
+ - name: Failed task
+ fail:
+ msg: no reason
+ ignore_errors: yes
+
+ - name: Skipped task
+ command: echo foo
+ when: false
+
+ - name: Task with var in name ({{ foo }})
+ command: echo foo
+
+ - name: Loop task
+ command: echo foo
+ loop:
+ - 1
+ - 2
+ - 3
+ loop_control:
+ label: foo-{{ item }}
+
+ # detect "changed" debug tasks being hidden with display_ok_tasks=false
+ - name: debug loop
+ debug:
+ msg: debug-{{ item }}
+ changed_when: item == 1
+ failed_when: item == 2
+ when: item != 4
+ ignore_errors: yes
+ loop:
+ - 1
+ - 2
+ - 3
+ - 4
+ loop_control:
+ label: debug-{{ item }}
+
+ - block:
+ - name: EXPECTED FAILURE Failed task to be rescued
+ fail:
+ rescue:
+ - name: Rescue task
+ command: echo rescued
+
+ - include_tasks: include_me.yml
+ loop:
+ - 1
+
+ handlers:
+ - name: Test handler 1
+ command: echo foo
+ listen: test handlers
+
+ - name: Test handler 2
+ command: echo foo
+ changed_when: false
+ listen: test handlers
+
+ - name: Test handler 3
+ command: echo foo
+ listen: test handlers
+
+# An issue was found previously for tasks in a play using strategy 'free' after
+# a non-'free' play in the same playbook, so we protect against a regression.
+- hosts: testhost
+ gather_facts: no
+ strategy: free
+ tasks:
+ - name: First free task
+ command: echo foo
+
+ - name: Second free task
+ command: echo foo
diff --git a/test/integration/targets/callback_default/test_2.yml b/test/integration/targets/callback_default/test_2.yml
new file mode 100644
index 00000000..2daded71
--- /dev/null
+++ b/test/integration/targets/callback_default/test_2.yml
@@ -0,0 +1,6 @@
+- hosts: nonexistent
+ gather_facts: no
+ tasks:
+ - name: Test task for unreachable host
+ command: echo foo
+ ignore_errors: True
diff --git a/test/integration/targets/callback_default/test_dryrun.yml b/test/integration/targets/callback_default/test_dryrun.yml
new file mode 100644
index 00000000..26cf0831
--- /dev/null
+++ b/test/integration/targets/callback_default/test_dryrun.yml
@@ -0,0 +1,93 @@
+---
+- name: A common play
+ hosts: testhost
+ gather_facts: no
+ tasks:
+ - debug:
+ msg: 'ansible_check_mode: {{ansible_check_mode}}'
+
+ - name: Command
+ command: ls -l
+
+ - name: "Command with check_mode: false"
+ command: ls -l
+ check_mode: false
+
+ - name: "Command with check_mode: true"
+ command: ls -l
+ check_mode: true
+
+
+- name: "Play with check_mode: true (runs always in check_mode)"
+ hosts: testhost
+ gather_facts: no
+ check_mode: true
+ tasks:
+ - debug:
+ msg: 'ansible_check_mode: {{ansible_check_mode}}'
+
+ - name: Command
+ command: ls -l
+
+ - name: "Command with check_mode: false"
+ command: ls -l
+ check_mode: false
+
+ - name: "Command with check_mode: true"
+ command: ls -l
+ check_mode: true
+
+
+- name: "Play with check_mode: false (runs always in wet mode)"
+ hosts: testhost
+ gather_facts: no
+ check_mode: false
+ tasks:
+ - debug:
+ msg: 'ansible_check_mode: {{ansible_check_mode}}'
+
+ - name: Command
+ command: ls -l
+
+ - name: "Command with check_mode: false"
+ command: ls -l
+ check_mode: false
+
+ - name: "Command with check_mode: true"
+ command: ls -l
+ check_mode: true
+
+
+- name: "Play with a block with check_mode: true"
+ hosts: testhost
+ gather_facts: no
+ tasks:
+ - block:
+ - name: Command
+ command: ls -l
+
+ - name: "Command with check_mode: false"
+ command: ls -l
+ check_mode: false
+
+ - name: "Command with check_mode: true"
+ command: ls -l
+ check_mode: true
+ check_mode: true
+
+- name: "Play with a block with check_mode: false"
+ hosts: testhost
+ gather_facts: no
+ tasks:
+ - block:
+ - name: Command
+ command: ls -l
+
+ - name: "Command with check_mode: false"
+ command: ls -l
+ check_mode: false
+
+ - name: "Command with check_mode: true"
+ command: ls -l
+ check_mode: true
+ check_mode: false
diff --git a/test/integration/targets/callback_default/test_non_lockstep.yml b/test/integration/targets/callback_default/test_non_lockstep.yml
new file mode 100644
index 00000000..b656ee91
--- /dev/null
+++ b/test/integration/targets/callback_default/test_non_lockstep.yml
@@ -0,0 +1,7 @@
+---
+- hosts: nonlockstep
+ gather_facts: false
+ tasks:
+ - command: sleep {{ i }}
+ - command: sleep {{ i }}
+ - command: sleep {{ i }}