From be99b1c801a2f3137fb2985308ddb7da3e41cc6d Mon Sep 17 00:00:00 2001 From: Carlos Matos Date: Tue, 22 Oct 2024 18:15:23 -0400 Subject: [PATCH] fix(falcon_install): use win_stat to expand %SYSTEMROOT% properly windows sucks... nuff said :( --- roles/falcon_install/tasks/api.yml | 2 +- roles/falcon_install/tasks/preinstall.yml | 8 ++++++++ roles/falcon_install/tasks/win_install.yml | 2 +- roles/falcon_install/tasks/win_url.yml | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/roles/falcon_install/tasks/api.yml b/roles/falcon_install/tasks/api.yml index 4548741..f4264b9 100644 --- a/roles/falcon_install/tasks/api.yml +++ b/roles/falcon_install/tasks/api.yml @@ -93,7 +93,7 @@ - name: CrowdStrike Falcon | Copy Sensor Installation Package to remote host (windows) ansible.windows.win_copy: src: "{{ falcon_sensor_download.path }}" - dest: "{{ falcon_windows_tmp_dir }}" + dest: "{{ falcon_windows_tmp_dir_stat.stat.path }}" changed_when: false register: win_falcon_sensor_copied when: ansible_os_family == "Windows" diff --git a/roles/falcon_install/tasks/preinstall.yml b/roles/falcon_install/tasks/preinstall.yml index 7d30840..11dee2c 100644 --- a/roles/falcon_install/tasks/preinstall.yml +++ b/roles/falcon_install/tasks/preinstall.yml @@ -99,6 +99,14 @@ - ansible_facts['os_family'] == "Windows" changed_when: no +- name: CrowdStrike Falcon | Validate Temporary install directory (Windows) + ansible.windows.win_stat: + path: "{{ falcon_windows_tmp_dir }}" + when: + - ansible_facts['os_family'] == "Windows" + register: falcon_windows_tmp_dir_stat + failed_when: false + - name: CrowdStrike Falcon | Verify Falcon is not already installed (macOS) ansible.builtin.stat: path: "{{ falcon_path }}" diff --git a/roles/falcon_install/tasks/win_install.yml b/roles/falcon_install/tasks/win_install.yml index 5528fdc..d231f76 100644 --- a/roles/falcon_install/tasks/win_install.yml +++ b/roles/falcon_install/tasks/win_install.yml @@ -14,6 +14,6 @@ - name: CrowdStrike Falcon | Remove tmp install directory (Windows) ansible.windows.win_file: - path: "{{ falcon_windows_tmp_dir }}" + path: "{{ falcon_windows_tmp_dir_stat.stat.path }}" state: absent changed_when: no diff --git a/roles/falcon_install/tasks/win_url.yml b/roles/falcon_install/tasks/win_url.yml index 6ec04e7..9149da3 100644 --- a/roles/falcon_install/tasks/win_url.yml +++ b/roles/falcon_install/tasks/win_url.yml @@ -2,12 +2,12 @@ - name: CrowdStrike Falcon | Downloading Installation Package from URL (Windows) ansible.windows.win_get_url: url: "{{ falcon_download_url }}" - dest: "{{ falcon_windows_tmp_dir }}" + dest: "{{ falcon_windows_tmp_dir_stat.stat.path }}" url_username: "{{ falcon_download_url_username | default(omit) }}" url_password: "{{ falcon_download_url_password | default(omit) }}" when: - falcon_download_url - - falcon_windows_tmp_dir + - falcon_windows_tmp_dir_stat.stat.path register: falcon_sensor_download retries: "{{ falcon_retries }}" delay: "{{ falcon_delay }}"