aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible/roles/wrk
diff options
context:
space:
mode:
authorvagrant <pmikus@cisco.com>2020-02-04 14:16:01 +0000
committerPeter Mikus <pmikus@cisco.com>2020-02-07 20:08:43 +0000
commit8605f3f406468f57bb9b2eac12a4421f65965300 (patch)
tree5eef32ff0298ab1c3ac593adced4a502d7c8ea17 /resources/tools/testbed-setup/ansible/roles/wrk
parentd7e14a0a93e7e06047daeaf6a5575f227aeb925a (diff)
CSIT Azure integration
+ Terraform + Ansible Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I353511c5ef39d8c8d43fedc61c8dbb30b4821e1b
Diffstat (limited to 'resources/tools/testbed-setup/ansible/roles/wrk')
-rw-r--r--resources/tools/testbed-setup/ansible/roles/wrk/defaults/main.yaml20
-rw-r--r--resources/tools/testbed-setup/ansible/roles/wrk/tasks/main.yaml53
2 files changed, 73 insertions, 0 deletions
diff --git a/resources/tools/testbed-setup/ansible/roles/wrk/defaults/main.yaml b/resources/tools/testbed-setup/ansible/roles/wrk/defaults/main.yaml
new file mode 100644
index 0000000000..d40ea6a9ce
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/wrk/defaults/main.yaml
@@ -0,0 +1,20 @@
+---
+# file: roles/wrk/defaults/main.yaml
+
+packages: "{{ packages_base + packages_by_distro[ansible_distribution | lower] + packages_by_arch[ansible_machine] }}"
+
+packages_base:
+ - []
+
+packages_by_distro:
+ ubuntu:
+ - "build-essential"
+
+packages_by_arch:
+ aarch64:
+ - []
+ x86_64:
+ - []
+
+wrk_target_dir: "/opt"
+wrk_version: "4.0.2"
diff --git a/resources/tools/testbed-setup/ansible/roles/wrk/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/wrk/tasks/main.yaml
new file mode 100644
index 0000000000..d8d06145db
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/wrk/tasks/main.yaml
@@ -0,0 +1,53 @@
+---
+# file: roles/wrk/tasks/main.yaml
+
+- name: WRK Install - Install Distribution - Release - Machine Prerequisites
+ package:
+ name: "{{ packages | flatten(levels=1) }}"
+ state: latest
+ update_cache: true
+ tags:
+ - install-dependencies
+
+- 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