diff --git a/roles/2-common/tasks/fl.yml b/roles/2-common/tasks/fl.yml index 30c8266e7..0235c2522 100644 --- a/roles/2-common/tasks/fl.yml +++ b/roles/2-common/tasks/fl.yml @@ -12,7 +12,7 @@ - "{{ py3_dist_path }}/iiab" # /usr/lib/python3/dist-packages - "{{ yum_packages_dir }}" # /opt/iiab/yum-packages - "{{ pip_packages_dir }}" # /opt/iiab/pip-packages - - "{{ downloads_dir }}" # /opt/iiab/downloads + - "{{ downloads_dir }}" # /opt/iiab/downloads -- generally already done by Stage 1's roles/remoteit/tasks/install.yml #- "{{ content_base }}/downloads" # /library/downloads auto-created just below - "{{ content_base }}/downloads/zims" - "{{ content_base }}/downloads/maps" diff --git a/roles/remoteit/README.md b/roles/remoteit/README.md index 55c38d415..93e19d515 100644 --- a/roles/remoteit/README.md +++ b/roles/remoteit/README.md @@ -14,7 +14,7 @@ To install remote.it onto an IIAB: ``` -3. To obtain this IIAB's 8-letter remote.it claim code, allowing you to make a remote connection to this IIAB, run: +3. To obtain this IIAB's 8-character remote.it claim code, allowing you to make a remote connection to this IIAB, run: ``` sudo grep claim /etc/remoteit/config.json ``` @@ -40,4 +40,4 @@ For "auto-registration" of remote.it, and other more advanced configuration opti # Known Issues - 2021-10-27: This needs to be enhanced rather urgently, so remote.it also works when IIAB is installed on Raspberry Pi OS 11 (Bullseye), Ubuntu, Mint and Debian: [#3006](https://github.com/iiab/iiab/issues/3006) -- 2021-10-28: The above OS issues should be resolved by [PR #3007](https://github.com/iiab/iiab/pull/3007), but this needs final testing! +- 2021-10-29: The above OS issues should be resolved by [PR #3007](https://github.com/iiab/iiab/pull/3007), [PR #3009](https://github.com/iiab/iiab/pull/3009) and [PR #3010](https://github.com/iiab/iiab/pull/3010) — but this needs final testing! (Initial testing occurred on [1] 32-bit Raspberry Pi OS Lite on Raspberry Pi 4 and [2] Ubuntu Server 20.04 on x86_64 VM.) diff --git a/roles/remoteit/defaults/main.yml b/roles/remoteit/defaults/main.yml index cc0eec337..e15969e6c 100644 --- a/roles/remoteit/defaults/main.yml +++ b/roles/remoteit/defaults/main.yml @@ -6,27 +6,31 @@ # All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml # If nec, change them by editing /etc/iiab/local_vars.yml prior to installing! -# See https://docs.remote.it/cli/overview to refine either value below: remoteit_version: 4.13.5 -iset_suffixes: - x86_64: amd64 - aarch64: arm64 - armv8: arm64.rpi + +# See https://docs.remote.it/device-package/installation to refine URL below: +device_suffixes: armv6: armhf.rpi armv6l: armhf.rpi armv7: armhf.rpi armv7l: armhf.rpi -remoteit_iset_suffix: "{{ iset_suffixes[ansible_architecture] | default('unknown') }}" -remoteit_deb: remoteit-{{ remoteit_version }}.{{ remoteit_iset_suffix }}.deb -remoteit_device_url: https://downloads.remote.it/remoteit/v{{ remoteit_version }}/{{ remoteit_deb }} - -iset_suffixes2: - x86_64: amd64 + armv8: arm64.rpi aarch64: arm64 + x86_64: amd64 +remoteit_device_suffix: "{{ device_suffixes[ansible_architecture] | default('unknown') }}" +remoteit_deb: remoteit-{{ remoteit_version }}.{{ remoteit_device_suffix }}.deb +remoteit_device_url: https://downloads.remote.it/remoteit/v{{ remoteit_version }}/{{ remoteit_deb }} +# Example... https://downloads.remote.it/remoteit/v4.13.5/remoteit-4.13.5.armhf.rpi.deb + +# See https://docs.remote.it/cli/overview to refine URL below: +cli_suffixes: armv6: armv6 armv6l: armv6 armv7: armv7 armv7l: armv7 armv8: arm64 -remoteit_iset_suffix2: "{{ iset_suffixes2[ansible_architecture] | default('unknown') }}" -remoteit_cli_url: https://downloads.remote.it/cli/latest/remoteit_linux_{{ remoteit_iset_suffix2 }} + aarch64: arm64 + x86_64: amd64 +remoteit_cli_suffix: "{{ cli_suffixes[ansible_architecture] | default('unknown') }}" +remoteit_cli_url: https://downloads.remote.it/cli/latest/remoteit_linux_{{ remoteit_cli_suffix }} +# Example... https://downloads.remote.it/cli/latest/remoteit_linux_armv7 diff --git a/roles/remoteit/tasks/enable-or-disable.yml b/roles/remoteit/tasks/enable-or-disable.yml index af75a2a00..2e1ddb36f 100644 --- a/roles/remoteit/tasks/enable-or-disable.yml +++ b/roles/remoteit/tasks/enable-or-disable.yml @@ -6,17 +6,6 @@ state: restarted when: remoteit_enabled -- name: Find the uuid for the connector - shell: ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit - register: remoteit_service - ignore_errors: yes - -- name: Stop the uuid {{ remoteit_service.stdout }} - systemd: - name: "{{ remoteit_service.stdout }}" - enabled: no - state: stopped - when: not remoteit_enabled and not remoteit_service.stdout == "" - name: Disable & Stop remote.it's connectd daemon systemd: @@ -24,3 +13,16 @@ enabled: no state: stopped when: not remoteit_enabled + +- name: Identify remoteit service (connector) unit file name, including uuid + shell: ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit # e.g. remoteit@80:00:01:7F:7E:00:56:36.service + register: remoteit_service + ignore_errors: yes + +- name: "Disable & Stop remoteit 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/tasks/install.yml b/roles/remoteit/tasks/install.yml index 8e0a9ea0e..f839788cb 100644 --- a/roles/remoteit/tasks/install.yml +++ b/roles/remoteit/tasks/install.yml @@ -1,35 +1,42 @@ -- name: Fail if we detect unknown architecture +- name: Fail if architecture remoteit_device_suffix == "unknown" fail: - msg: "Could not find an apt package for the CPU architecture \"{{ ansible_architecture }}\"" - when: remoteit_iset_suffix == "unknown" + msg: "Could not find a remote.it device apt package for CPU architecture \"{{ ansible_architecture }}\"" + when: remoteit_device_suffix == "unknown" -- name: Fail if we detect unknown architecture - fail: - msg: "Could not find a binary for the CPU architecture \"{{ ansible_architecture }}\"" - when: remoteit_iset_suffix2 == "unknown" +- name: mkdir {{ downloads_dir }} # As roles/2-common/tasks/fl.yml has not run yet + file: + path: "{{ downloads_dir }}" # /opt/iiab/downloads + state: directory -- name: Download {{ remoteit_cli_url }} for the {{ remoteit_iset_suffix2 }} arch of this device to /usr/bin/remoteit (755) +- name: Download {{ remoteit_device_url }} (device) for arch {{ remoteit_device_suffix }} into {{ downloads_dir }}/ get_url: - url: '{{ remoteit_cli_url }}' - dest: /usr/bin/remoteit - mode: 0755 + url: "{{ remoteit_device_url }}" + dest: "{{ downloads_dir }}/" -- name: Download {{ remoteit_device_url }} for the {{ remoteit_iset_suffix }} arch of this device package to {{ downloads_dir }} - get_url: - url: '{{ remoteit_device_url }}' - dest: '{{ downloads_dir }}/' - -- name: Uninstall the device 'remoteit' deb package +- name: Uninstall previously installed 'remoteit*' device apt package(s) apt: name: remoteit* state: absent + ignore_errors: yes -- name: Install device package {{ downloads_dir }}/{{ remoteit_deb }} +- name: Install device apt package {{ downloads_dir }}/{{ remoteit_deb }} apt: - deb: '{{ downloads_dir }}/{{ remoteit_deb }}' + deb: "{{ downloads_dir }}/{{ remoteit_deb }}" state: present +- name: Fail if architecture remoteit_cli_suffix == "unknown" + fail: + msg: "Could not find a remote.it CLI binary for CPU architecture \"{{ ansible_architecture }}\"" + when: remoteit_cli_suffix == "unknown" + +- name: Download {{ remoteit_cli_url }} (CLI) for arch {{ remoteit_cli_suffix }} to /usr/bin/remoteit (755) + get_url: + url: "{{ remoteit_cli_url }}" + dest: /usr/bin/remoteit + mode: 0755 + + # RECORD remoteit AS INSTALLED - name: "Set 'remoteit_installed: True'" diff --git a/test.yml b/test.yml index ac372d43a..0b50a13b0 100644 --- a/test.yml +++ b/test.yml @@ -33,12 +33,12 @@ debug: msg: "'\"'" # FAILS: "'""'" - - name: a shows "VARIABLE IS NOT DEFINED!" -- whereas b (w/o whitespace) AND c (with space) AND d (with tab) show null (without quotes!) -- whereas d (singlequotes) and e (doublequotes) show "" empty string + - name: a shows "VARIABLE IS NOT DEFINED!" -- whereas b (w/o whitespace) AND c (with space) AND d (with tab, STRICTLY DISALLOWED IN YAML BY ansible-core 2.11.6) showed null (without quotes!) -- whereas e (singlequotes) and f (doublequotes) show "" empty string set_fact: #a: b: c: # Space - d: # Tab + #d: # Tab e: '' f: ""