Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ebpf): robustify probe unloading in case of ebpf #442

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions roles/agent_install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- name: Configure Sysdig Agent Repository
ansible.builtin.include_tasks: "agent/configure-{{ 'rpm' if ansible_pkg_mgr in ['dnf', 'yum'] else 'deb' }}-repository.yml"

- name: Install Sysdig Agent (latest)

Check warning on line 25 in roles/agent_install/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint-branch

package-latest

Package installs should not use latest.
ansible.builtin.package:
name: draios-agent
state: latest
Expand Down Expand Up @@ -80,10 +80,22 @@
state: stopped
when: agent_install_probe_loaded.stdout == 'LOADED'

- name: (eBPF) Determine if sysdigcloud_probe module is still loaded after stop
ansible.builtin.shell:
cmd: |
set -o pipefail
lsmod | grep -q sysdigcloud_probe && echo -n LOADED || echo -n NOT_LOADED
executable: bash
register: agent_install_probe_loaded_after_stop
changed_when: agent_install_probe_loaded_after_stop.stdout == 'LOADED'

- name: (eBPF) Ensure kernel module is not loaded
ansible.builtin.command: modprobe -r sysdigcloud_probe
ansible.builtin.shell:
cmd: |
modprobe -r sysdigcloud_probe || rmmod sysdigcloud_probe
executable: bash
register: agent_install_probe_removed
when: agent_install_probe_loaded.stdout == 'LOADED'
when: agent_install_probe_loaded_after_stop.stdout == 'LOADED'
changed_when: agent_install_probe_removed.rc == 0

- name: (kmod) Disable eBPF
Expand Down
Loading