Implement sipp ansible role

This commit is contained in:
ionutboangiu
2024-05-13 19:36:56 +03:00
committed by Dan Christian Bogos
parent 75694bd75d
commit 8be19292aa
3 changed files with 75 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
changed_when: false
- name: Remove current installation.
become: yes
become: true
file:
state: absent
path: /usr/local/go
@@ -16,7 +16,7 @@
- go_version not in go_version_result.stdout
- name: Download Go.
become: yes
become: true
get_url:
url: "{{ go_download_url }}"
dest: /usr/local/src/{{ go_tarball }}
@@ -26,7 +26,7 @@
- (go_version_result is failed or go_version not in go_version_result.stdout)
- name: Extract Go.
become: yes
become: true
unarchive:
src: /usr/local/src/{{ go_tarball }}
dest: /usr/local
@@ -36,7 +36,7 @@
- (go_version_result is failed or go_version not in go_version_result.stdout)
- name: Add Go to to system-wide $PATH.
become: yes
become: true
copy:
dest: /etc/profile.d/go-path.sh
content: |-

View File

@@ -0,0 +1,13 @@
---
sipp_clone_path: '{{ ansible_env.HOME }}'
sipp_bin_path: /usr/local/bin
sipp_cmake_flags: '' # '-DUSE_SSL=1 -DUSE_SCTP=1 -DUSE_PCAP=1 -DUSE_GSL=1'
sipp_remove_source: true
sipp_version: v3.7.2
sipp_dependencies:
- git
- cmake
- make
- gcc
- g++
- libncurses-dev

View File

@@ -0,0 +1,58 @@
---
- name: Check if SIPp is installed and get version
ansible.builtin.shell:
cmd: sipp -v | grep 'SIPp v' | awk '{print $2}' | sed 's/.$//'
register: sipp_installed_version
ignore_errors: true
changed_when: false
# - name: Debug SIPp version
# debug:
# msg: "Installed SIPp version is '{{ sipp_installed_version.stdout }}'"
- name: Install dependencies for building SIPp
become: true
ansible.builtin.apt:
name: '{{ sipp_dependencies }}'
state: present
when: sipp_installed_version.stdout != sipp_version and ansible_os_family == "Debian"
- name: Clone SIPp repository
ansible.builtin.git:
repo: https://github.com/SIPp/sipp.git
dest: '{{ sipp_clone_path }}/sipp'
version: '{{ sipp_version }}'
when: sipp_installed_version.stdout != sipp_version
- name: Build SIPp
block:
- name: Create build directory
ansible.builtin.file:
path: '{{ sipp_clone_path }}/sipp/build'
state: directory
- name: Run CMake
ansible.builtin.command:
cmd: cmake .. {{ sipp_cmake_flags }}
chdir: '{{ sipp_clone_path }}/sipp/build'
- name: Run Make
ansible.builtin.command:
cmd: make
chdir: '{{ sipp_clone_path }}/sipp/build'
when: sipp_installed_version.stdout != sipp_version
- name: Move SIPp binary to the installation path
become: true
ansible.builtin.copy:
src: '{{ sipp_clone_path }}/sipp/build/sipp'
dest: '{{ sipp_bin_path }}'
remote_src: yes
mode: '0755'
when: sipp_installed_version.stdout != sipp_version
- name: Remove SIPp source directory
ansible.builtin.file:
path: '{{ sipp_clone_path }}/sipp'
state: absent
when: sipp_installed_version.stdout != sipp_version and sipp_remove_source