Install arduino IDE
This commit is contained in:
parent
0cfbf63221
commit
074a547621
@ -1,4 +1,9 @@
|
|||||||
---
|
---
|
||||||
arduino_version: "1.8.18"
|
arduino_version: "1.8.13"
|
||||||
|
|
||||||
|
#https://www.arduino.cc/download_handler.php?f=/arduino-1.8.13-linuxarm.tar.xz
|
||||||
|
#arduino_ide_url: "https://downloads.arduino.cc/arduino-1.8.13-linuxaarch64.tar.xz"
|
||||||
arduino_ide_url: "https://downloads.arduino.cc/arduino-{{ arduino_version }}-linuxarm.tar.xz"
|
arduino_ide_url: "https://downloads.arduino.cc/arduino-{{ arduino_version }}-linuxarm.tar.xz"
|
||||||
arduino_download_directory: /opt/arduino
|
arduino_download_directory: /opt/arduino
|
||||||
|
|
||||||
|
arduino_port: "/dev/ttyACM0"
|
||||||
|
@ -9,3 +9,46 @@
|
|||||||
- name: "install inotool with pip"
|
- name: "install inotool with pip"
|
||||||
pip:
|
pip:
|
||||||
name: ino
|
name: ino
|
||||||
|
|
||||||
|
- name: Create Arduino download directory.
|
||||||
|
become: yes
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ arduino_download_directory }}"
|
||||||
|
mode: "0755"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
|
||||||
|
- name: Download Arduino IDE and checksum files.
|
||||||
|
become: yes
|
||||||
|
get_url:
|
||||||
|
url: "{{ arduino_ide_url }}"
|
||||||
|
dest: "{{ arduino_download_directory }}/{{ arduino_ide_url|basename }}"
|
||||||
|
|
||||||
|
- name: Extract Arduino archive.
|
||||||
|
become: yes
|
||||||
|
unarchive:
|
||||||
|
src: "{{ arduino_download_directory }}/{{ arduino_ide_url|basename }}"
|
||||||
|
dest: "{{ arduino_download_directory }}/"
|
||||||
|
remote_src: yes
|
||||||
|
creates: "{{ arduino_download_directory }}/arduino-{{ arduino_version }}"
|
||||||
|
|
||||||
|
- name: Install Arduino IDE.
|
||||||
|
become: yes
|
||||||
|
command: "{{ arduino_download_directory }}/arduino-{{ arduino_version }}/install.sh"
|
||||||
|
# Cheating a bit and chaining the install.sh logic with directory extraction,
|
||||||
|
# to maintain idempotence.
|
||||||
|
args:
|
||||||
|
creates: "{{ arduino_download_directory }}/arduino-{{ arduino_version }}"
|
||||||
|
|
||||||
|
- name: Installs Arduino helper scripts.
|
||||||
|
become: yes
|
||||||
|
template:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: "/usr/local/bin/{{ item.rstrip('.j2') }}"
|
||||||
|
mode: "0755"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
with_items:
|
||||||
|
- arduino-push.j2
|
||||||
|
- arduino-verify.j2
|
||||||
|
18
roles/arduino/templates/arduino-push.j2
Normal file
18
roles/arduino/templates/arduino-push.j2
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
# Ensure sketchfile is provided as an argument. This is the code file
|
||||||
|
# that will be compiled and pushed to the Arduino board.
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "Usage: $0 <sketchfile>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Declare path to Arduino binary. Will change according to Arduino version use.
|
||||||
|
ARDUINO_BINARY="/opt/arduino/arduino-{{ arduino_version }}/arduino"
|
||||||
|
|
||||||
|
# Push code file to Arduino board
|
||||||
|
$ARDUINO_BINARY --port "{{ arduino_port }}" --upload "$1"
|
17
roles/arduino/templates/arduino-verify.j2
Normal file
17
roles/arduino/templates/arduino-verify.j2
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
# Ensure sketchfile is provided as an argument. This is the code file
|
||||||
|
# that will be compiled and its results reported.
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "Usage: $0 <sketchfile>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Declare path to Arduino binary. Will change according to Arduino version use.
|
||||||
|
ARDUINO_BINARY="/opt/arduino/arduino-{{ arduino_version }}/arduino"
|
||||||
|
|
||||||
|
# Build and verify code file without pushing to board.
|
||||||
|
$ARDUINO_BINARY --verify "$1"
|
Loading…
Reference in New Issue
Block a user