Skip to content

Commit

Permalink
use pip requirements file to install python libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
layereight committed Nov 1, 2023
1 parent 07f2b73 commit 0e95f93
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions ansible/MFRC522-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,23 @@
- python3-pip
- vim

python_packages:
- RPi.GPIO
- spidev
- fastjsonschema==2.14.1
- assertpy

tasks:

- name: "Run apt-get update if cache is older than a week"
- name: "Install prerequisite debian packages"
become: yes
apt:
name: "{{ debian_packages }}"
update_cache: yes
cache_valid_time: 604800 # 1 week = 7 * 24 * 3600 seconds

- name: "Install prerequisite debian packages"
become: yes
apt:
name: "{{ debian_packages }}"
- name: "Install pip requirements file"
copy:
src: ../requirements.txt
dest: /tmp/requirements_MFRC522-trigger.txt

- name: "Install prerequisite pip packages"
become: yes
pip:
name: "{{ python_packages }}"
executable: pip3

- name: "Install pi-rc522 python library"
become: yes
pip:
name: pi-rc522
requirements: /tmp/requirements_MFRC522-trigger.txt
executable: pip3

- name: Prepare Raspberry Pi's /boot/config.txt
Expand Down

0 comments on commit 0e95f93

Please sign in to comment.