---
- name: "Ensure {{ app_name }} is installed"
  unarchive:
    src: "{%- if ansible_architecture == 'x86_64' %}{{ ngrok_x86_64_url }}
    {%- elif ('64' in ansible_architecture and ('aarch' in ansible_architecture or 'arm' in ansible_architecture)) %}{{ ngrok_arm64_url }}
    {%- else %}{{ ngrok_arm32_url }}{%- endif %}"
    dest: /usr/local/bin
    remote_src: true
    extra_opts:
      - -j

- name: Add configuration to user dotfiles
  include_tasks: config-Linux.yml
  when:
    - user.ngrok_token is defined
    - (user.system is not defined) or ((user.system is defined) and (not user.system))
  loop: "{{ user_configs }}"
  loop_control:
    label: "{{ user.username }}"
    loop_var: user
