From 4e10b918c068a164e4408ca266f4caf528cf9b7e Mon Sep 17 00:00:00 2001 From: Victor Vanhooren Date: Wed, 18 Sep 2024 10:04:15 +0200 Subject: [PATCH] 1406 fix windows tasks to be compatible with check mode --- roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml b/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml index f312253df..89ae1db4a 100644 --- a/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml +++ b/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml @@ -53,11 +53,13 @@ - wazuh_agent_status.stat.checksum != extracted_checksum.stdout_lines[0] when: - wazuh_winagent_config.check_sha512 + ignore_errors: "{{ ansible_check_mode }}" - name: Windows | Install Agent if not already installed win_package: path: "{{ wazuh_winagent_config.download_dir }}{{ wazuh_winagent_package_name }}" state: present + ignore_errors: "{{ ansible_check_mode }}" - name: Windows | Check if client.keys exists win_stat: @@ -65,6 +67,7 @@ register: check_windows_key tags: - config + ignore_errors: "{{ ansible_check_mode }}" - name: Windows | Register agent win_shell: > @@ -81,11 +84,13 @@ - wazuh_agent_authd.registration_address is not none tags: - config + ignore_errors: "{{ ansible_check_mode }}" - name: Windows | Check if ossec folder is accessible win_file: path: "{{ wazuh_agent_win_path }}" state: directory + ignore_errors: "{{ ansible_check_mode }}" - name: Windows | Installing agent configuration (ossec.conf) template: # noqa 208 @@ -107,8 +112,10 @@ win_file: path: "{{ wazuh_winagent_config.download_dir }}{{ wazuh_winagent_package_name }}" state: absent + ignore_errors: "{{ ansible_check_mode }}" - name: Windows | Delete downloaded checksum file win_file: path: "{{ wazuh_winagent_config.download_dir }}{{ wazuh_winagent_package_name }}.sha512" state: absent + ignore_errors: "{{ ansible_check_mode }}"