Skip to content

Commit

Permalink
fix(falcon_install): fixes issue with deleting sensor when running lo…
Browse files Browse the repository at this point in the history
…cally (#584)

* fix(falcon_install): fixes issue with deleting sensor when running localhost

Fixes #578

This PR addresses the issue of prematurely deleting the downloaded
sensor file prior to installation. We have removed the logic to it's own
task file that runs at the end of the play.

* chore: add changelog and some gitignore stuff
  • Loading branch information
carlosmmatos authored Dec 4, 2024
1 parent c7060d2 commit 5bc59d9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ __pycache__/
/.vscode
html/
ansible.cfg
Vagrantfile
.vagrant/
2 changes: 2 additions & 0 deletions changelogs/fragments/578-localhost-deletion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- falcon_install - fixes issue with premature localhost deletion of downloaded sensor (https://github.com/CrowdStrike/ansible_collection_falcon/pull/584)
11 changes: 0 additions & 11 deletions roles/falcon_install/tasks/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,6 @@
register: win_falcon_sensor_copied
when: ansible_os_family == "Windows"

- name: CrowdStrike Falcon | Remove Downloaded Sensor Installation directory (local)
ansible.builtin.file:
path: "{{ item }}"
state: absent
changed_when: false
delegate_to: localhost
loop:
- "{{ falcon_sensor_download.path }}"
- "{{ falcon_sensor_download.path + '.lock' }}"
when: falcon_api_sensor_download_cleanup

- name: CrowdStrike Falcon | Set full file download path (non-windows)
ansible.builtin.set_fact:
falcon_sensor_pkg: "{{ falcon_sensor_copied.dest }}"
Expand Down
10 changes: 10 additions & 0 deletions roles/falcon_install/tasks/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- name: CrowdStrike Falcon | Remove Downloaded Sensor Installation directory (local)
ansible.builtin.file:
path: "{{ item }}"
state: absent
changed_when: false
delegate_to: localhost
loop:
- "{{ falcon_sensor_download.path }}"
- "{{ falcon_sensor_download.path + '.lock' }}"
when: falcon_api_sensor_download_cleanup
7 changes: 7 additions & 0 deletions roles/falcon_install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@
block:
- ansible.builtin.include_tasks: win_install.yml
# noqa name[missing]

- name: Cleanup block
when:
- falcon_install_method == "api"
block:
- ansible.builtin.include_tasks: cleanup.yml
# noqa name[missing]

0 comments on commit 5bc59d9

Please sign in to comment.