Skip to content

Instantly share code, notes, and snippets.

@cirocosta
Created October 8, 2018 20:31
Show Gist options
  • Save cirocosta/46a2f57a15a34837ba55434dd93abcdb to your computer and use it in GitHub Desktop.
Save cirocosta/46a2f57a15a34837ba55434dd93abcdb to your computer and use it in GitHub Desktop.
bpftrace ansible role (from https://github.com/cirocosta/mylinux)
---
- name: 'add llvm apt key'
apt_key:
url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
state: 'present'
- name: 'add llvm apt repo'
apt_repository:
repo: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main'
state: 'present'
update_cache: 'yes'
- name: 'install bpftrace dependencies'
apt:
update_cache: 'yes'
cache_valid_time: 3600
name: '{{ item }}'
state: 'present'
with_items:
- 'bison'
- 'clang-6.0'
- 'clang-6.0-doc'
- 'clang-tools-6.0'
- 'cmake'
- 'flex'
- 'g++'
- 'git'
- 'libclang-6.0-dev'
- 'libclang-common-6.0-dev'
- 'libclang1-6.0'
- 'libelf-dev'
- 'libfl-dev'
- 'libllvm6.0'
- 'llvm-6.0'
- 'llvm-6.0-dev'
- 'llvm-6.0-runtime'
- 'zlib1g-dev'
- name: 'clone bpftrace repository'
git:
repo: 'https://github.com/iovisor/bpftrace'
dest: '/usr/share/bpftrace'
force: 'yes'
- name: 'create build directory'
file:
path: '/usr/share/bpftrace/build'
state: 'directory'
mode: 0755
- name: 'prepare makefile'
command: 'cmake -DCMAKE_BUILD_TYPE=DEBUG ..'
args:
chdir: '/usr/share/bpftrace/build'
- name: 'build'
command: 'make -j3'
args:
chdir: '/usr/share/bpftrace/build'
- name: 'install'
command: 'make -j3'
args:
chdir: '/usr/share/bpftrace/build'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment