2022-04-03 03:41:49 +00:00
# - name: Fail if architecture remoteit_device_suffix == "unknown"
# fail:
# msg: "Could not find a remote.it Device Package (.deb) for CPU architecture \"{{ ansible_architecture }}\""
# when: remoteit_device_suffix == "unknown"
2021-10-28 07:09:24 +00:00
2022-04-01 04:18:32 +00:00
# - name: mkdir {{ downloads_dir }} # As roles/2-common/tasks/fl.yml has not run yet
# file:
# path: "{{ downloads_dir }}" # /opt/iiab/downloads
# state: directory
2021-10-25 18:59:16 +00:00
2022-04-01 04:18:32 +00:00
# - name: Download {{ remoteit_device_url }} (Device Package) for arch {{ remoteit_device_suffix }} into {{ downloads_dir }}/
# get_url:
# url: "{{ remoteit_device_url }}"
# dest: "{{ downloads_dir }}/"
# force: yes
# timeout: "{{ download_timeout }}"
2021-10-27 21:29:31 +00:00
2022-04-04 01:57:23 +00:00
# 2022-04-03: Unfort still necessary, as their install_agent.sh below uses apt
# with 'install -y' instead of '-y reinstall' or '-y --reinstall install'
2022-04-07 14:17:35 +00:00
# FWIW: Some remoteit.*.deb installers also work with '-y --allow-downgrades install'
# (e.g. *.amd64.deb) but others (e.g. both *.rpi.deb) do not.
2022-04-03 03:41:49 +00:00
- name : Purge previously installed 'remoteit*' Device Package(s)
2021-10-27 21:29:31 +00:00
apt :
2021-10-28 23:04:40 +00:00
name : remoteit*
2021-10-27 23:10:09 +00:00
state : absent
2022-04-03 03:41:49 +00:00
purge : yes
2021-10-29 04:11:56 +00:00
ignore_errors : yes
2021-10-27 23:10:09 +00:00
2022-04-06 22:13:05 +00:00
# Speeds things up a bit, deferring online claim code generation if not nec:
# https://docs.remote.it/oem-and-bulk-provisioning/registration-into-a-users-account
2022-04-07 14:17:35 +00:00
# - name: "'mkdir /etc/remoteit' e.g. if your 'remoteit_license_key: 592AA9BB-XXXX-YYYY-ZZZZ-6E27654C3DF6' exists in /etc/iiab/local_vars.yml"
# file:
# state: directory
# path: /etc/remoteit
# when: remoteit_license_key is defined
# - name: "'touch /etc/remoteit/registration' e.g. if your 'remoteit_license_key: 592AA9BB-XXXX-YYYY-ZZZZ-6E27654C3DF6' exists in /etc/iiab/local_vars.yml"
# file:
# state: touch
# path: /etc/remoteit/registration
# when: remoteit_license_key is defined
- name : "'mkdir /etc/remoteit'"
2022-04-06 22:13:05 +00:00
file :
state : directory
path : /etc/remoteit
2022-04-07 14:17:35 +00:00
- name : "'touch /etc/remoteit/registration' to block generation of claim code below, also speeding things up a bit"
2022-04-06 22:13:05 +00:00
file :
state : touch
path : /etc/remoteit/registration
2022-04-01 04:18:32 +00:00
# - name: "Install Device Package: {{ downloads_dir }}/{{ remoteit_deb }}"
# apt:
# deb: "{{ downloads_dir }}/{{ remoteit_deb }}"
2022-04-03 03:41:49 +00:00
# - name: "Install Device Package: {{ remoteit_device_url }}"
# apt:
# deb: "{{ remoteit_device_url }}"
2022-04-07 14:17:35 +00:00
# - name: Install remote.it Device Package for your CPU/OS, using https://downloads.remote.it/remoteit/install_agent.sh -- this puts a claim code in /etc/remoteit/config.json which is valid for 24h
- name : Install remote.it Device Package for your CPU/OS, using https://downloads.remote.it/remoteit/install_agent.sh
2022-04-03 03:41:49 +00:00
shell : curl -L https://downloads.remote.it/remoteit/install_agent.sh | sh
2022-04-06 22:13:05 +00:00
2022-04-07 14:17:35 +00:00
- name : "'rm /etc/remoteit/registration' (empty file used just above)"
file :
state : absent
path : /etc/remoteit/registration
ignore_errors : yes # In case a future version of install_agent.sh deletes it for us
2022-04-06 12:12:23 +00:00
- name : Install /usr/bin/iiab-remoteit from template -- so IIAB operators can quickly enable remote.it AND generate a new remote.it claim code (in /etc/remoteit/config.json) -- optionally downloading + installing the very latest Device Package (like the 2 steps above)
2022-04-03 03:41:49 +00:00
template :
src : iiab-remoteit
dest : /usr/bin
mode : 0755
2021-10-27 23:10:09 +00:00
2022-04-06 12:12:23 +00:00
- name : Install /usr/bin/iiab-remoteit-off from template -- so IIAB operators can quickly turn off AND disable remote.it services on this IIAB
2022-04-04 04:04:19 +00:00
template :
src : iiab-remoteit-off
dest : /usr/bin
mode : 0755
2021-10-25 18:59:16 +00:00
2021-10-29 04:11:56 +00:00
- 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"
2022-04-01 04:18:32 +00:00
- name : Download OPTIONAL {{ remoteit_cli_url }} (CLI) to /usr/bin/remoteit (755)
2021-10-29 04:11:56 +00:00
get_url :
url : "{{ remoteit_cli_url }}"
dest : /usr/bin/remoteit
mode : 0755
2021-10-29 04:50:16 +00:00
force : yes
2021-12-26 15:24:31 +00:00
timeout : "{{ download_timeout }}"
2021-10-29 04:11:56 +00:00
2022-04-01 04:18:32 +00:00
# RECORD remote.it AS INSTALLED
2021-10-25 18:59:16 +00:00
2021-10-28 23:00:00 +00:00
- name : "Set 'remoteit_installed: True'"
2021-10-25 18:59:16 +00:00
set_fact :
remoteit_installed : True
- name : "Add 'remoteit_installed: True' to {{ iiab_state_file }}"
lineinfile :
path : "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp : '^remoteit_installed'
line: 'remoteit_installed : True '