Use ansible to deploy iperf3
Step 1: Install Ansible (if not already installed):
On Linux (Ubuntu/Debian):
bash
sudo apt update
sudo apt install ansible
Step 2: Set Up Your Inventory File
Create an Ansible inventory file to specify the target VMs. An example inventory file, inventory.ini
, could look like this:
ini
[servers] server1 ansible_host=192.168.1.10
server2 ansible_host=192.168.1.11
[all:vars] ansible_user=your_user
ansible_ssh_private_key_file=/path/to/your/private_key
Step 3: Install iperf3 on the Target VMs Using Ansible
To install iperf3 on your VMs, create an Ansible playbook (install_iperf3.yml
) with the following content:
yaml
---
- name: Install iperf3 on target VMs
hosts: servers
become: yes
tasks:
- name: Install iperf3
apt:
name: iperf3
state: present
when: ansible_os_family == "Ubuntu"
Run this command to install iperf3 on all VMs
Step 4: Configure and Run the iperf3 Test
Now, create a playbook (run_iperf3.yml
) to configure and run the iperf3 network speed test between your VMs.
Use this command to run the playbook above which runs iperf3 on vms
You can view the results of the file with
This downloads the file from server 2