From 49fd61019b2fbd77f1751f6c124cde6df0718f7b Mon Sep 17 00:00:00 2001 From: Pi Date: Thu, 14 Mar 2019 14:27:10 -0400 Subject: [PATCH] initial download and build of sipp still need to copy startup scripts (client/server) and cron --- hosts | 2 ++ main.yaml | 3 +++ roles/common/tasks/main.yaml | 7 ++++++ roles/sipclient/files/startclient.sh | 8 +++++++ roles/sipclient/tasks/main.yaml | 33 ++++++++++++++++++++++++++++ roles/sipserver/files/start.sh | 9 ++++++++ 6 files changed, 62 insertions(+) create mode 100755 roles/sipclient/files/startclient.sh create mode 100755 roles/sipclient/tasks/main.yaml create mode 100755 roles/sipserver/files/start.sh diff --git a/hosts b/hosts index ce37b25..c0274c7 100755 --- a/hosts +++ b/hosts @@ -77,3 +77,5 @@ sdwcltm8 sdwsrvm ubuntu-server-1 +[sipclient] +sdwcltm6 diff --git a/main.yaml b/main.yaml index a23d82a..e7eb433 100644 --- a/main.yaml +++ b/main.yaml @@ -36,3 +36,6 @@ - hosts: all roles: - nrpe +- hosts: sipclient + roles: + - sipclient diff --git a/roles/common/tasks/main.yaml b/roles/common/tasks/main.yaml index 64fb998..f7cf332 100755 --- a/roles/common/tasks/main.yaml +++ b/roles/common/tasks/main.yaml @@ -23,3 +23,10 @@ content: "{{ lookup('template', '{{ role_path }}/templates/hosts.j2') }}" state: present tags: update_hosts +- name: install programs and libraries + become: true + apt: + name: [ 'expect', 'ftp', 'cadaver', 'iperf', 'iperf3', 'libpcap0.8', 'libsctp1', 'libsctp-dev', 'libncurses-dev', 'libssl-dev', 'libpcap-dev', 'vim', 'mc', 'smbclient', 'ncurses-dev' ] + update_cache: true + state: present + tags: install_packages diff --git a/roles/sipclient/files/startclient.sh b/roles/sipclient/files/startclient.sh new file mode 100755 index 0000000..bb988a4 --- /dev/null +++ b/roles/sipclient/files/startclient.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if pgrep sipp >/dev/null +then + echo "sipp is running" +else + cd /home/pi/sipp + ./sipp -sn uac_pcap 192.168.198.2 -bg -l 10 +fi diff --git a/roles/sipclient/tasks/main.yaml b/roles/sipclient/tasks/main.yaml new file mode 100755 index 0000000..89410f5 --- /dev/null +++ b/roles/sipclient/tasks/main.yaml @@ -0,0 +1,33 @@ +--- +- name: download sipp source + get_url: + url: "https://github.com/SIPp/sipp/releases/download/v3.5.2/sipp-3.5.2.tar.gz" + dest: "/home/pi/sipp-3.5.2.tar.gz" + register: sipp_source + tags: sipp +- name: Unpacking SIPP + unarchive: + copy: no + dest: /home/pi/ + src: "/home/pi/sipp-3.5.2.tar.gz" + when: sipp_source.changed + register: sipp_source_unpack + tags: sipp +- name: move sipp directory + command: 'mv sipp-3.5.2 sipp' + when: sipp_source_unpack is changed + register: sipp_move_directory + tags: sipp +- name: configure sipp + command: "./configure --with-openssl --with-pcap --with-sctp" + args: + chdir: "/home/pi/sipp" + when: sipp_move_directory is changed + tags: sipp + register: sipp_configure +- name: build sipp + shell: make + when: sipp_configure is changed + args: + chdir: "/home/pi/sipp" + tags: sipp diff --git a/roles/sipserver/files/start.sh b/roles/sipserver/files/start.sh new file mode 100755 index 0000000..d695833 --- /dev/null +++ b/roles/sipserver/files/start.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if pgrep sipp >/dev/null +then + echo "sipp is running" +else + cd /home/pi/sipp + ./sipp -sn uas -bg +fi +