ansible/pis/07-dhtsensor.yml

21 lines
770 B
YAML

---
- hosts: kitchenpi
gather_facts: false
remote_user: root
tasks:
- name: apt install libgpiod2
apt: name=libgpiod2 cache_valid_time=7200 state=present
- name: pip install adafruit-circuitpython-dht
pip:
name: adafruit-circuitpython-dht
executable: pip3
- name: Install script config
template: src=configs/dht22_sensing.json dest=/etc/dht22_sensing.json
- name: Install script
copy: src=configs/dht22_sensing.py dest=/usr/bin/dht22_sensing owner=root mode=u+rwx
- name: Install systemd service file
copy: src=configs/dht22_sensing.service dest=/lib/systemd/system/
- name: Add script to autostart and start now
systemd: name=dht22_sensing state=restarted enabled=yes daemon_reload=yes