aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml
blob: e7d22e1aa1e1a12a4f9115ec12b02a29e1bffb14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
# file: roles/tg/tasks/wrk.yaml

- name: Download WRK release archive
  get_url:
    url: '{{ wrk.url }}/{{ wrk.version }}.tar.gz'
    dest: '{{ wrk.target_dir }}/{{ wrk.version }}.tar.gz'
    mode: 0644
  register: 'linux__wrk_downloaded'
  tags: install-wrk

- name: Ensure WRK directory exists
  file:
    path: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}'
    state: 'directory'
  register: 'linux__wrk_dir_created'
  tags: install-wrk

- name: Extract WRK release archive
  become: yes
  unarchive:
    src: '{{ wrk.target_dir }}/{{ wrk.version }}.tar.gz'
    dest: '{{ wrk.target_dir }}/'
    creates: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}/src'
    remote_src: yes
  when: 'linux__wrk_dir_created'
  register: 'linux__wrk_extracted'
  tags: install-wrk

- name: Compile WRK release
  become: yes
  shell: 'cd {{ wrk.target_dir }}/wrk-{{ wrk.version }}; make'
  when: 'linux__wrk_extracted'
  register: 'linux__wrk_compiled'
  tags: install-wrk

- name: Move WRK binary
  become: yes
  command: 'mv {{ wrk.target_dir }}/wrk-{{ wrk.version }}/wrk /usr/local/bin/'
  when: 'linux__wrk_compiled'
  tags: install-wrk