Skip to content

Commit a56753f

Browse files
author
Matheus Marchini
committed
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. Ref: nodejs#1274
1 parent 839fc90 commit a56753f

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
3+
#
4+
# installs Linux perf @ /usr/local/bin/perf
5+
#
6+
7+
- stat: path=/usr/local/bin/perf
8+
register: linux_perf
9+
tags: linux_perf
10+
11+
- name: Clean path
12+
file:
13+
state: absent
14+
path: /data/tmp/
15+
when: linux_perf.stat.exists == False
16+
tags: linux_perf
17+
18+
- name: Download Linux source code
19+
git:
20+
repo: https://github.com/torvalds/linux.git
21+
depth: 1
22+
dest: /data/tmp/linux
23+
when: linux_perf.stat.exists == False
24+
tags: linux_perf
25+
26+
- name: Install build-essential
27+
package:
28+
name: build-essential
29+
state: present
30+
when: linux_perf.stat.exists == False
31+
tags: linux_perf
32+
33+
- name: Install flex
34+
package:
35+
name: flex
36+
state: present
37+
when: linux_perf.stat.exists == False
38+
tags: linux_perf
39+
40+
- name: Install bison
41+
package:
42+
name: bison
43+
state: present
44+
when: linux_perf.stat.exists == False
45+
tags: linux_perf
46+
47+
- name: build Linux perf
48+
shell: make -j{{ ansible_processor_cores }}
49+
args:
50+
chdir: /data/tmp/linux/tools/perf
51+
when: linux_perf.stat.exists == False
52+
tags: linux_perf
53+
54+
- name: install Linux perf
55+
shell: cp /data/tmp/linux/tools/perf/perf /usr/local/bin/perf
56+
when: linux_perf.stat.exists == False
57+
tags: linux_perf
58+
59+
- name: Clean path
60+
file:
61+
state: absent
62+
path: /data/tmp/
63+
when: linux_perf.stat.exists == False
64+
tags: linux_perf

0 commit comments

Comments
 (0)