1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/remoteit/tasks/install.yml

80 lines
2.9 KiB
YAML

# - 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"
# - 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_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 }}"
# 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'
- name: Purge previously installed 'remoteit*' Device Package(s)
apt:
name: remoteit*
state: absent
purge: yes
ignore_errors: yes
# - name: "Install Device Package: {{ downloads_dir }}/{{ remoteit_deb }}"
# apt:
# deb: "{{ downloads_dir }}/{{ remoteit_deb }}"
# - name: "Install Device Package: {{ remoteit_device_url }}"
# apt:
# deb: "{{ remoteit_device_url }}"
- name: Going to use pre-created REGISTRATION_CODE from desktop or web portal
shell: mkdir /etc/remoteit || true && touch /etc/remoteit/registration
when: remoteit_REGISTRATION_CODE is not none
- name: Install remote.it Device Package for your CPU/OS, using https://downloads.remote.it/remoteit/install_agent.sh
shell: curl -L https://downloads.remote.it/remoteit/install_agent.sh | sh
- 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)"
template:
src: iiab-remoteit
dest: /usr/bin
mode: 0755
- name: "Install /usr/bin/iiab-remoteit-off from template -- so IIAB operators can quickly turn off AND disable remote.it services on this IIAB"
template:
src: iiab-remoteit-off
dest: /usr/bin
mode: 0755
- 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 OPTIONAL {{ remoteit_cli_url }} (CLI) to /usr/bin/remoteit (755)
get_url:
url: "{{ remoteit_cli_url }}"
dest: /usr/bin/remoteit
mode: 0755
force: yes
timeout: "{{ download_timeout }}"
# RECORD remote.it AS INSTALLED
- name: "Set 'remoteit_installed: True'"
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'