-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansible: add role to install Linux perf on Ubuntu
Ansible role to install Linux perf on Ubuntu by cloning the Linux source code and building tools/perf to avoid Kernel mismatch errors. PR-URL: #1231 Ref: #1274 Reviewed-By: Jon Moss <me@jonathanmoss.me>
- Loading branch information
Showing
3 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
|
||
# | ||
# installs Linux perf @ /usr/local/bin/perf | ||
# | ||
|
||
- stat: | ||
path: /usr/local/bin/perf | ||
register: linux_perf | ||
tags: linux_perf | ||
|
||
- name: install perf on linux | ||
tags: linux_perf | ||
when: not (linux_perf.stat.exists | bool) | ||
block: | ||
- name: Clean path | ||
file: | ||
state: absent | ||
path: "{{ tmp_folder }}" | ||
|
||
- name: Download Linux source code | ||
git: | ||
repo: https://github.com/torvalds/linux.git | ||
depth: 1 | ||
dest: "{{ tmp_folder }}/linux" | ||
|
||
- name: Install packages | ||
package: | ||
name: "{{ package }}" | ||
state: present | ||
loop_control: | ||
loop_var: package | ||
with_items: "{{ packages }}" | ||
|
||
- name: build Linux perf | ||
shell: make -j{{ ansible_processor_cores | default(1) }} | ||
args: | ||
chdir: "{{ tmp_folder }}/linux/tools/perf" | ||
|
||
- name: install Linux perf | ||
shell: "cp {{ tmp_folder }}/linux/tools/perf/perf /usr/local/bin/perf" | ||
|
||
- name: Clean path | ||
file: | ||
state: absent | ||
path: "{{ tmp_folder }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
packages: | ||
- build-essential | ||
- flex | ||
- bison | ||
tmp_folder: /data/tmp |