From c9086061ca192e058f991d647ad5e7344dc0747b Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Thu, 21 Mar 2024 01:34:57 +1000 Subject: Allow check mode async task disabling check_mode (#82827) * Allow check mode async task disabling check_mode Allows running an async task with check_mode: False when the playbook is being run in check mode. * Add check_mode attribute to internal cleanup task --- test/integration/targets/async/check_task_test.yml | 8 ++++++++ test/integration/targets/async/tasks/main.yml | 12 ++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 test/integration/targets/async/check_task_test.yml (limited to 'test/integration/targets') diff --git a/test/integration/targets/async/check_task_test.yml b/test/integration/targets/async/check_task_test.yml new file mode 100644 index 0000000000..f8756408a1 --- /dev/null +++ b/test/integration/targets/async/check_task_test.yml @@ -0,0 +1,8 @@ +- hosts: localhost + gather_facts: false + tasks: + - name: Async in check mode task disabled test + command: sleep 5 + async: 6 + poll: 1 + check_mode: False diff --git a/test/integration/targets/async/tasks/main.yml b/test/integration/targets/async/tasks/main.yml index f5e5c992e7..491be966a0 100644 --- a/test/integration/targets/async/tasks/main.yml +++ b/test/integration/targets/async/tasks/main.yml @@ -298,3 +298,15 @@ - assert: that: - '"ASYNC POLL on localhost" in callback_output.stdout' + +- name: run playbook in --check with task disabling check mode + command: ansible-playbook {{ role_path }}/check_task_test.yml --check + register: check_task_disabled_output + delegate_to: localhost + environment: + ANSIBLE_NOCOLOR: 'true' + ANSIBLE_FORCE_COLOR: 'false' + +- assert: + that: + - '"ASYNC OK on localhost" in check_task_disabled_output.stdout' -- cgit v1.2.3