2022-04-08 13:25:36 +00:00
# Passwords and license keys in /etc/iiab/local_vars.yml are not a healthy
# precedent :/ (Going forward let's try to keep credentials in their own apps)
2022-04-08 04:34:41 +00:00
- name : Copy OPTIONAL remoteit_license_key, e.g. from /etc/iiab/local_vars.yml to /etc/remoteit/registration, if remoteit_license_key is defined
2022-04-06 22:13:05 +00:00
# shell: echo {{ remoteit_license_key }} > /etc/remoteit/registration
template :
src : registration.j2
dest : /etc/remoteit/registration
2022-04-08 03:44:00 +00:00
when : remoteit_license_key is defined
2022-04-06 22:13:05 +00:00
2022-04-08 04:34:41 +00:00
- name : Redact OPTIONAL remoteit_license_key from /etc/iiab/local_vars.yml, if remoteit_license_key is defined
2022-04-06 22:13:05 +00:00
# shell: sed -i '/^remoteit_license_key:/d' {{ iiab_local_vars_file }}
lineinfile :
path : "{{ iiab_local_vars_file }}"
regexp : '^remoteit_license_key:.*'
state : absent
2022-04-08 03:44:00 +00:00
when : remoteit_license_key is defined
2022-04-06 22:13:05 +00:00
2022-10-09 18:51:49 +00:00
- name : Does empty file /etc/remoteit/registration exist?
stat :
path : /etc/remoteit/registration
register : remoteit_reg
2022-10-09 21:09:23 +00:00
- name : Remove empty file /etc/remoteit/registration if remoteit_enabled, so claim code can be generated
2022-10-09 18:51:49 +00:00
file :
path : /etc/remoteit/registration
state : absent
when : remoteit_enabled and remoteit_reg.stat.exists and remoteit_reg.stat.size == 0
2022-10-09 21:09:23 +00:00
# 2022-10-09: refresh.sh is equivalent to their old connectd "parent" systemd
# service, that they removed from 4.15.2 device packages on 2022-09-07.
# (Either way, the job below never deletes /etc/remoteit/registration)
2022-04-06 16:34:03 +00:00
2022-10-09 22:31:22 +00:00
- name : 'Run /usr/share/remoteit/refresh.sh to put a claim code in /etc/remoteit/config.json (if you don' 't already have a license key in /etc/remoteit/registration) -- FYI this spawns 2 "child" services/daemons: schannel & e.g. remoteit@80:00:01:7F:7E:00:56:36.service'
2022-10-09 21:09:23 +00:00
command : /usr/share/remoteit/refresh.sh
2022-04-04 02:58:28 +00:00
when : remoteit_enabled
2022-10-09 21:09:23 +00:00
# - name: Enable & Restart remote.it "parent" service connectd, which exits after spawning 2 "child" services/daemons below
# systemd:
# name: connectd
# daemon_reload: yes
# enabled: yes
# state: restarted
# when: remoteit_enabled
# 2022-10-09: refresh.sh (above) now takes care of this too
# - name: Enable remote.it daemon schannel ("Remote tcp command service") -- try to avoid contention with connectd which auto-spawns it as nec (just above)
# systemd:
# name: schannel
# enabled: yes
# state: started
# when: remoteit_enabled
2021-10-25 18:59:16 +00:00
2021-10-29 01:26:26 +00:00
2022-10-09 21:09:23 +00:00
- name : Disable & Stop remote.it service schannel
2021-10-29 01:26:26 +00:00
systemd :
2022-10-09 21:09:23 +00:00
name : schannel
2021-10-29 01:26:26 +00:00
enabled : no
state : stopped
2021-10-29 04:11:56 +00:00
when : not remoteit_enabled
2021-10-29 01:26:26 +00:00
2022-04-06 03:30:29 +00:00
- name : Stop & Disable "Remote tcp connection services" remoteit@* found in /etc/systemd/system/multi-user.target.wants/ e.g. remoteit@80:00:01:7F:7E:00:56:36.service
2022-04-06 02:06:18 +00:00
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@*)
2021-10-29 04:11:56 +00:00
ignore_errors : yes
2022-04-06 02:06:18 +00:00
when : not remoteit_enabled
2021-10-29 04:11:56 +00:00
2022-04-06 02:06:18 +00:00
# - 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