- name: Prepare
  hosts: all
  become: true
  gather_facts: true
  tasks:
  - name: Install vcan kernel module via linux-modules-extra package and can-utils
    apt:
      name:
        - linux-modules-extra-{{ansible_kernel}}
        - can-utils
      state: present

  - name: Create Robot Folder
    ansible.builtin.file:
      path: "/home/robot"
      state: directory

  - name: Create CAN File
    ansible.builtin.file:
      path: "/home/robot/ecu_tester.sh"
      state: touch

  - name: Add line to rc.local file
    ansible.builtin.lineinfile:
      path: /etc/rc.local
      line: /home/robot/can_tester.sh || exit 1

