diff --git a/hosts b/hosts index 407e904..d84c2f0 100644 --- a/hosts +++ b/hosts @@ -77,3 +77,7 @@ wes-host2 [ap] # raspberry pi will act as an access point - needs "site_clli" set on host + +[tcgui] +# web based interface to tc on port 5000 for introducing latency, loss, jitter + diff --git a/main.yaml b/main.yaml index e902258..9496ddd 100644 --- a/main.yaml +++ b/main.yaml @@ -58,3 +58,6 @@ - hosts: snmpd roles: - snmpd +- hosts: tcgui + roles: + - tcgui diff --git a/roles/common/vars/os_Raspbian_10.yml b/roles/common/vars/os_Raspbian_10.yml index 01f5ad9..7be703a 100644 --- a/roles/common/vars/os_Raspbian_10.yml +++ b/roles/common/vars/os_Raspbian_10.yml @@ -24,3 +24,4 @@ dependency_packages: - chromium-browser - raspberrypi-ui-mods - mtr + - screen diff --git a/roles/common/vars/os_Raspbian_9.yml b/roles/common/vars/os_Raspbian_9.yml index 01f5ad9..7be703a 100644 --- a/roles/common/vars/os_Raspbian_9.yml +++ b/roles/common/vars/os_Raspbian_9.yml @@ -24,3 +24,4 @@ dependency_packages: - chromium-browser - raspberrypi-ui-mods - mtr + - screen diff --git a/roles/common/vars/os_Ubuntu_18.yml b/roles/common/vars/os_Ubuntu_18.yml index d8e935c..37ed7b7 100644 --- a/roles/common/vars/os_Ubuntu_18.yml +++ b/roles/common/vars/os_Ubuntu_18.yml @@ -6,3 +6,4 @@ dependency_packages: - openvpn - aptitude - mtr + - screen diff --git a/roles/tcgui/files/tcgui.service b/roles/tcgui/files/tcgui.service new file mode 100644 index 0000000..3a88593 --- /dev/null +++ b/roles/tcgui/files/tcgui.service @@ -0,0 +1,9 @@ +[Unit] +Description=tcgui server +After=syslog.target network.target auditd.service + +[Service] +ExecStart=/usr/bin/python3 /home/pi/tcgui/main.py --dev eth0 --ip 0.0.0.0 + +[Install] +WantedBy=multi-user.target diff --git a/roles/tcgui/tasks/main.yaml b/roles/tcgui/tasks/main.yaml new file mode 100644 index 0000000..06302d7 --- /dev/null +++ b/roles/tcgui/tasks/main.yaml @@ -0,0 +1,36 @@ +--- +- name: check if tcgui exists + stat: + path: "{{ ansible_user_dir }}/tcgui/main.py" + register: tcgui_installed +- name: clone tcgui + git: + repo: https://github.com/tum-lkn/tcgui.git + dest: "{{ ansible_user_dir }}/tcgui" + when: tcgui_installed.stat.exists == false +- name: check if tcgui systemd installed + stat: + path: /etc/systemc/system/tcgui.service + register: tcgui_systemd_installed +- name: install tcgui systemd + become: yes + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: root + group: root + with_items: + - { src: "{{ role_path }}/files/tcgui.service", dest: "/etc/systemd/system/tcgui.service" } + when: tcgui_systemd_installed.stat.exists == false +- name: reload systemd + become: true + systemd: + daemon_reload: yes + tags: test +- name: start tcgui + become: yes + systemd: + name: tcgui.service + state: restarted + enabled: yes + diff --git a/temp.yaml b/temp.yaml index 1f1760c..6c6a426 100644 --- a/temp.yaml +++ b/temp.yaml @@ -1,4 +1,4 @@ --- -- hosts: snmpd +- hosts: tcgui roles: - - snmpd + - tcgui