win_package and check_mode

Hello,

I have a question about running win_package in check_mode.

My playbook (part of it):

  • name: Copy Splunk Forwarder MSI
    win_copy:
    src: “{{ splunk_forwarder_distro }}”
    dest: “{{ splunk_forwarder_distro_local }}”
    force: yes
    remote_src: no

  • name: Install Splunk Forwarder
    win_package:
    expected_return_code: 0,3010
    state: present
    arguments: “{{ splunk_forwarder_arguments }}”
    path: “{{ splunk_forwarder_distro_local }}”

When I run it in check_mode, the first task will work correctly and say that it would copy the file.
The second task fails since the file in path is missing.

I do not want to set check_mode:no for the first task and copy the file in check_mode just to have win_package working.

What is the best way to make win_package working in check_mode if the file in path is missing?

Thank you,

  • Igor