- name: Set up Raspberry Pi
hosts: raspberry_pi
become: yes
tasks:
- name: Install requirements
local_action: command ansible-galaxy install -r requirements.yml
become: no
tags:
- setup
- name: Setup
import_role:
name: reitermarkus.raspberry_pi.setup
vars:
timezone: Europe/Vienna
watchdog: on
- name: Set core frequency
include_role:
name: infothrill.rpi_boot_config
vars:
boot_config:
core_freq: '250'
- name: Build program
local_action: command cargo install --bin somfy --features=server --path . --root target
become: no
- name: Install program
copy:
src: target/bin/somfy
dest: /usr/local/bin/somfy
mode: 0755
- name: Enable systemd-networkd-wait-online service
systemd:
name: systemd-networkd-wait-online
enabled: yes
- name: Install service
copy:
content: |
[Unit]
Description=somfy
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
Environment=RUST_LOG=info
Environment=PORT=8888
ExecStart=/usr/local/bin/somfy server --config /home/pi/config.yaml
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target
dest: /etc/systemd/system/somfy.service
- name: Enable service
systemd:
daemon_reload: true
name: somfy
enabled: yes
state: restarted