-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81f3ef2
commit 57865f9
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=Pyduino Daemon | ||
After=network.target | ||
|
||
[Service] | ||
WorkingDirectory=/home/pi/pyduino-parallel | ||
ExecStart=/usr/bin/python3 /home/pi/pyduino-parallel/init_slave.py | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
- name: Setup Arduino Environment | ||
hosts: reactors | ||
become: yes | ||
gather_facts: yes | ||
vars_prompt: | ||
- name: "GH_TOKEN" | ||
prompt: "GitHub Token" | ||
private: true | ||
vars: | ||
library_version: 0.1 | ||
|
||
tasks: | ||
- name: Ensure required packages are installed | ||
apt: | ||
name: "{{ item }}" | ||
state: present | ||
loop: | ||
- git | ||
- unzip | ||
- python3 | ||
- python3-pip | ||
when: ansible_os_family == 'Debian' | ||
|
||
- name: Download repository | ||
get_url: | ||
url: https://github.com/fotobiolab-unb/pyduino-parallel/archive/v{{ library_version }}.zip | ||
dest: /home/pi/pyduino-parallel.zip | ||
headers: | ||
Authorization: "token {{ GH_TOKEN }}" | ||
when: ansible_os_family == 'Debian' | ||
|
||
- name: Unzip repository | ||
block: | ||
|
||
- name: Delete folder if exists | ||
file: | ||
path: /home/pi/pyduino-parallel | ||
state: absent | ||
|
||
- name: Extract and move | ||
unarchive: | ||
remote_src: yes | ||
src: /home/pi/pyduino-parallel.zip | ||
dest: /home/pi | ||
|
||
- name: Install Python Libraries | ||
command: pip3 install -r /home/pi/pyduino-parallel/requirements.txt | ||
|
||
- name: Moving unit file to Systemd | ||
block: | ||
|
||
- name: Delete file if exists | ||
file: | ||
path: /etc/systemd/system/pyduino.service | ||
state: absent | ||
|
||
- name: Copy file | ||
copy: | ||
src: /home/pi/pyduino-parallel/reactors/pyduino.service | ||
dest: /etc/systemd/system/pyduino.service |
File renamed without changes.
File renamed without changes.