1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_iperf.git synced 2024-07-06 20:58:52 +02:00

completed the iperf3 setup

This commit is contained in:
L3D 2021-08-18 16:24:41 +02:00
parent f7d13643c6
commit 7bd75b0d65
Signed by: l3d
GPG key ID: CD08445BFF4313D1
7 changed files with 58 additions and 1 deletions

View file

@ -7,6 +7,9 @@ WORK IN PROGRESS
EVERYTHING CAN CHANGE ANY TIME
```
RTFM
https://iperf.fr/iperf-doc.php
Testing
----------
This role is tested with [these github-action](https://github.com/search?q=topic%3Acheck-ansible+topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories) tests for different versions of differen linux systems. Linting is tested via travis-ci and the [ansible-lint action](https://github.com/marketplace/actions/ansible-lint).

View file

@ -1,6 +1,7 @@
---
# run systemd service with an iperf3 server (Y/n)
iperf__systemd_enable: true
iperf__options: '-s'
iperf__packages:
- iperf3

8
handlers/main.yml Normal file
View file

@ -0,0 +1,8 @@
---
- name: systemctl restart iperf.service
become: true
ansible.builtin.systemd:
name: iperf.service
state: restarted
daemon_reload: true
when: iperf__systemd_enable | bool

View file

@ -8,3 +8,6 @@
- name: create iperf user
ansible.builtin.include_tasks: user.yml
- name: run systemd service
ansible.builtin.include_tasks: systemd.yml

28
tasks/systemd.yml Normal file
View file

@ -0,0 +1,28 @@
---
- name: deploy systemd iperf.service
become: true
ansible.builtin.template:
src: 'templates/iperf.service.j2'
dest: '/etc/systemd/system/iperf.service'
mode: 0644
group: root
owner: root
notify: systemctl restart iperf.service
- name: enable systemd iperf.service
become: true
ansible.buildin.systemd:
name: 'iperf.service'
enabled: true
masked: false
when: iperf__systemd_enable | bool
notify: systemctl restart iperf.service
- name: masked systemd iperf.service
become: true
ansible.buildin.systemd:
name: 'iperf.service'
state: stopped
enabled: false
masked: true
when: not iperf__systemd_enable | bool

View file

@ -0,0 +1,14 @@
[Unit]
Description=iperf3 Server
After=network.target
[Service]
Type=simple
User={{ iperf__user }}
Group={{ iperf__group }}
ExecStart=iperf3 {{ iperf__options }}
Restart=on-abort
[Install]
WantedBy=multi-user.target

View file

@ -1,4 +1,4 @@
---
# versionscheck
playbook_version_number: 03 # should be a integer
playbook_version_number: 4 # should be a integer
playbook_version_path: 'role-do1jlr.iperf.version'