diff --git a/ansible/roles/tier4_hdr_camera_driver/tasks/main.yaml b/ansible/roles/tier4_hdr_camera_driver/tasks/main.yaml index 9667d54..5b77a21 100644 --- a/ansible/roles/tier4_hdr_camera_driver/tasks/main.yaml +++ b/ansible/roles/tier4_hdr_camera_driver/tasks/main.yaml @@ -3,22 +3,12 @@ url: "{{ camera_driver_repo }}" register: github_api_return_info -- name: Check if GitHub API return is valid - fail: - msg: "Failed to fetch data from GitHub API." - when: github_api_return_info.status != 200 - - name: Parse download URL for driver loop: "{{ github_api_return_info.json.assets }}" ansible.builtin.set_fact: driver_deb_download_url: "{{ item.browser_download_url }}" driver_deb_name: "{{ item.name }}" - when: item.name | regex_search('tier4-camera-drivers-for-anvil.tar.gz') - -- name: Ensure driver_deb_download_url is defined - fail: - msg: "driver_deb_download_url is not defined. Check the regex or GitHub API response." - when: driver_deb_download_url is not defined + when: item.name | regex_search('tier4-camera-gmsl_(.+)_arm64.deb') - name: Parse download URL for SDK loop: "{{ github_api_return_info.json.assets }}" @@ -27,33 +17,12 @@ sdk_deb_name: "{{ item.name }}" when: item.name | regex_search('t4cam_sdk-(.+)-rqx58g.deb') -- name: Download driver tar.gz file from public repo - ansible.builtin.get_url: +- name: Download driver deb file from public repo + ansible.builtin.uri: url: "{{ driver_deb_download_url }}" dest: "{{ camera_driver_download_dir }}/{{ driver_deb_name }}" mode: 0644 -- name: Extract driver tar.gz file - ansible.builtin.unarchive: - src: "{{ camera_driver_download_dir }}/{{ driver_deb_name }}" - dest: "{{ camera_driver_download_dir }}" - remote_src: yes - -- name: Ensure install.sh has execute permission - ansible.builtin.file: - path: "{{ camera_driver_download_dir }}/tier4-camera-drivers-for-anvil/install.sh" - mode: '0755' - state: file - -- name: Fix shebang line in install.sh - ansible.builtin.shell: | - sed -i '1s/^#\/bin\/bash$/#!\/bin\/bash/' {{ camera_driver_download_dir }}/tier4-camera-drivers-for-anvil/install.sh - -- name: Run installation script - command: "echo $EUID && c {{ camera_driver_download_dir }}/tier4-camera-drivers-for-anvil/install.sh" - become: true - become_user: root - - name: Download SDK deb file from public repo ansible.builtin.uri: url: "{{ sdk_deb_download_url }}" @@ -76,12 +45,21 @@ - name: Setup camera driver and SDK become: true block: + - name: Install driver from deb file + ansible.builtin.apt: + deb: "{{ camera_driver_download_dir }}/{{ driver_deb_name }}" + state: present - name: Post process ansible.builtin.shell: cmd: | /opt/nvidia/jetson-io/config-by-hardware.py -n 2="TIERIV ISX021 GMSL2 Camera Device Tree Overlay" # noqa no-changed-when # TODO: check dtb file + - name: Install SDK from deb file + ansible.builtin.apt: + deb: "{{ camera_driver_download_dir }}/{{ sdk_deb_name }}" + state: present + when: sdk_deb_download_url is defined - name: Setup C1 configuration block: