---
- hosts: localhost
  vars:
    target_user: pi
    ignore_python_version: false 
    ignore_architecture: false
    jupyter_service: true
    jupyter_autostart: true
    jupyter_start: true

  pre_tasks:
    - name: Check python version
      fail:
        msg: "Python version is not supported. Expected 3.9.x . Set ignore_python_version to true to ignore this. Running on a different python version is not supported and will most likely not work."
      when: (not ignore_python_version) and not (ansible_python_version is version('3.9.0', '>=') and ansible_python_version is version('3.10.0', '<'))
    
    - name: Check architecture
      fail:
        msg: "CPU Architecture not compatible. Expected aarch64 (arm 64-bit). Set ignore_architecture to true to ignore this. Running on a different architecture is not supported and will most likely not work."
      when: not ignore_architecture and ansible_architecture != 'aarch64'

    - name: Update apt cache & install base requirements
      become: true
      apt:
        update_cache: true
        state: present
        name:
          - python3-pip
          - python3-venv

  roles:
    - telesec-globalroot-ca
    - git-clone
    - jupyter-lab
    - ml-python-packages
    - misc-applications
    - local-mdbook
