mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Implement sipp ansible role
This commit is contained in:
committed by
Dan Christian Bogos
parent
75694bd75d
commit
8be19292aa
@@ -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: |-
|
||||
|
||||
13
data/ansible/roles/sipp/defaults/main.yaml
Normal file
13
data/ansible/roles/sipp/defaults/main.yaml
Normal 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
|
||||
58
data/ansible/roles/sipp/tasks/main.yaml
Normal file
58
data/ansible/roles/sipp/tasks/main.yaml
Normal 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
|
||||
Reference in New Issue
Block a user