From f7e466b9737b307499e4328d2c9a4592a16a4d85 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Apr 2022 22:06:18 -0400 Subject: [PATCH] Stop & Disable any remoteit@* services (via Ansible or iiab-remoteit-off) --- roles/remoteit/tasks/enable-or-disable.yml | 27 ++++++++++++++-------- roles/remoteit/templates/iiab-remoteit-off | 9 ++++---- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/roles/remoteit/tasks/enable-or-disable.yml b/roles/remoteit/tasks/enable-or-disable.yml index 94857b31f..41abf0286 100644 --- a/roles/remoteit/tasks/enable-or-disable.yml +++ b/roles/remoteit/tasks/enable-or-disable.yml @@ -24,15 +24,22 @@ - schannel when: not remoteit_enabled -- name: Identify remoteit "Remote tcp connection service" unit file name, including uuid, e.g. remoteit@80:00:01:7F:7E:00:56:36.service - shell: ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@ - register: remoteit_service +- name: Stop & Disable any remoteit@* services found in /etc/systemd/system/multi-user.target.wants/ e.g. remoteit@80:00:01:7F:7E:00:56:36.service + shell: | + systemctl stop $(ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@*) + systemctl disable $(ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@*) ignore_errors: yes + when: not remoteit_enabled -- name: "Disable & Stop the actual service: {{ remoteit_service.stdout }}" - systemd: - name: "{{ remoteit_service.stdout }}" - enabled: no - state: stopped - when: not remoteit_enabled and remoteit_service.stdout != "" - ignore_errors: yes +# - name: Identify remoteit "Remote tcp connection service" unit file name, including uuid, e.g. remoteit@80:00:01:7F:7E:00:56:36.service +# shell: ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@ +# register: remoteit_service +# ignore_errors: yes + +# - name: "Disable & Stop the actual service: {{ remoteit_service.stdout }}" +# systemd: +# name: "{{ remoteit_service.stdout }}" +# enabled: no +# state: stopped +# when: not remoteit_enabled and remoteit_service.stdout != "" +# ignore_errors: yes diff --git a/roles/remoteit/templates/iiab-remoteit-off b/roles/remoteit/templates/iiab-remoteit-off index 44834300a..daf92b5db 100755 --- a/roles/remoteit/templates/iiab-remoteit-off +++ b/roles/remoteit/templates/iiab-remoteit-off @@ -26,7 +26,8 @@ systemctl stop schannel systemctl disable schannel # "Remote tcp connection service" -systemctl stop $(ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@) || true -systemctl disable $(ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@) || true -# Its systemd service name (e.g. remoteit@80:00:01:7F:7E:00:56:36.service) -# changes when a new claim code is generated! +systemctl stop $(ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@*) || true +systemctl disable $(ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@*) || true +# FYI these systemd service names e.g. remoteit@80:00:01:7F:7E:00:56:36.service +# change, and arise when a new claim code is generated, when the IIAB device is +# registed, etc. 2022-04-05 Example: https://github.com/iiab/iiab/issues/3166