Skip to content

Instantly share code, notes, and snippets.

@filipecosta90
Last active March 24, 2023 16:34
Show Gist options
  • Save filipecosta90/847aa0f185c0a09246abc76f8d7ce0b4 to your computer and use it in GitHub Desktop.
Save filipecosta90/847aa0f185c0a09246abc76f8d7ce0b4 to your computer and use it in GitHub Desktop.
Ubuntu Ansible Playbook to Install BCC (BPF Compiler Collection) Package Upstream Stable
---
- name: Install BCC (BPF Compiler Collection) Package Upstream Stable
hosts: all
connection: ssh
become: yes
become_user: root
become_method: sudo
vars:
- bccpath: '/usr/share/bcc/tools'
tasks:
- name: Add apt-key
become: yes
command: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD
- name: Add repo.iovisor.org
become: yes
apt_repository:
repo: deb https://repo.iovisor.org/apt/{{ansible_distribution_release}} {{ansible_distribution_release}} main
state: present
filename: iovisor
- name: Update
become: yes
command: apt update
- name: Install kernel-headers
become: yes
command: apt install linux-tools-{{ ansible_kernel }} -y
- name: Install bcc-tools libbcc-examples
become: yes
command: apt install bcc-tools libbcc-examples -y
- name: Add bcc bin dir to system-wide $PATH.
copy:
dest: /etc/profile.d/bccpath.sh
content: 'PATH=$PATH:{{ bccpath }}'
#enable other users to use the path
mode: '0644'
- name: Required reboot
reboot:
reboot_timeout: 300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment