aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml
blob: aee3761476edb450cc3bae6e89b6b307802b6e29 (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
---
# file: roles/tg/tasks/wrk.yaml

- name: WRK Install - Get Release Archive
  get_url:
    url: 'https://github.com/wg/wrk/archive/{{ wrk.version }}.tar.gz'
    dest: '{{ wrk.target_dir }}/{{ wrk.version }}.tar.gz'
    mode: 0644
  register: wrk_downloaded
  tags: install-wrk

- name: WRK Install - Ensure Directory Exists
  file:
    path: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}'
    state: 'directory'
  register: wrk_dir_created
  tags: install-wrk

- name: WRK Install - Extract Release Archive
  unarchive:
    remote_src: true
    src: '{{ wrk.target_dir }}/{{ wrk.version }}.tar.gz'
    dest: '{{ wrk.target_dir }}/'
    creates: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}/src'
  when: wrk_dir_created
  register: wrk_extracted
  tags: install-wrk

- name: WRK Install - Compile Release
  command: 'make'
  args:
    chdir: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}'
  when: wrk_extracted
  register: wrk_compiled
  tags: install-wrk

- name: WRK Install - Move Binary
  command: 'mv {{ wrk.target_dir }}/wrk-{{ wrk.version }}/wrk /usr/local/bin/'
  when: wrk_compiled
  tags: install-wrk