diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..1b862ee --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,3 @@ +--- +iperf3: + port: 9200 diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..ebd48d8 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,3 @@ +--- +# - name: Refresh aliases +# shell: newaliases diff --git a/meta/.galaxy_install_info b/meta/.galaxy_install_info new file mode 100644 index 0000000..9176024 --- /dev/null +++ b/meta/.galaxy_install_info @@ -0,0 +1,2 @@ +install_date: Sat Oct 22 16:45:23 2022 +version: '' diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..8d728a2 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,22 @@ +--- +galaxy_info: + author: Antonio J. Delgado (ajdelgado) + description: TODO - Description + +# issue_tracker_url: https://github.com/uoi-io/ansible-galera/issues + + license: GPLv3 + + min_ansible_version: "2.0" + + github_branch: master + + platforms: + - name: Ubuntu + versions: + - focal + - jammy + + galaxy_tags: []# TODO + +dependencies: [] \ No newline at end of file diff --git a/tasks/configure.yml b/tasks/configure.yml new file mode 100644 index 0000000..78f2aa3 --- /dev/null +++ b/tasks/configure.yml @@ -0,0 +1,18 @@ +--- +- name: Ensure iperf3 systemd unit is installed + template: + dest: /etc/systemd/system/iperf3.service + src: templates/iperf3.service.j2 + backup: yes + +- name: Ensure iperf3 service is enabled and running + systemd: + name: iperf3.service + state: started + enabled: yes + when: "'WSL' not in ansible_facts['kernel']" + +- name: Allow iperf3 port in UFW + ufw: + rule: allow + port: "{{ iperf3.port }}" diff --git a/tasks/install.yml b/tasks/install.yml new file mode 100644 index 0000000..0474945 --- /dev/null +++ b/tasks/install.yml @@ -0,0 +1,6 @@ +--- +- name: Ensure iperf packages are installed + package: + name: + - iperf + - iperf3 diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..cbe813e --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,5 @@ +--- +- name: Ensure installation + include_tasks: install.yml +- name: Ensure configuration + include_tasks: configure.yml \ No newline at end of file diff --git a/templates/iperf3.service.j2 b/templates/iperf3.service.j2 new file mode 100644 index 0000000..5e9ea55 --- /dev/null +++ b/templates/iperf3.service.j2 @@ -0,0 +1,14 @@ +# Managed by Ansible +# /etc/systemd/system/iperf3.service +# User service: $HOME/.config/systemd/user/iperf3.service + +[Unit] +Description=iperf3 server +After=syslog.target network.target auditd.service +OnFailure=status_email_antoniodelgado@%n.service + +[Service] +ExecStart=/usr/bin/iperf3 -s --port {{ iperf3.port }} + +[Install] +WantedBy=multi-user.target