ansible-pilote/tasks/serial2mqtt.yml
Julien Riou 38fef42aa6
style: Add ansible-lint
Signed-off-by: Julien Riou <julien@riou.xyz>
2024-05-10 13:32:56 +02:00

49 lines
1.2 KiB
YAML

---
- name: Install packages
ansible.builtin.apt:
name:
- python3-serial
- python3-paho-mqtt
- name: Clone arduino-sensors-toolkit sources
ansible.builtin.git:
repo: https://github.com/jouir/arduino-sensors-toolkit.git
dest: /opt/arduino-sensors-toolkit
- name: Add serial2mqtt user
ansible.builtin.user:
name: serial2mqtt
system: true
password: '!'
home: /var/lib/serial2mqtt
create_home: false
append: true
groups:
- dialout
- name: Copy serial2mqtt configuration
ansible.builtin.template:
src: serial2mqtt/serial2mqtt.ini.j2
dest: /etc/serial2mqtt.ini
mode: '0640'
owner: root
group: serial2mqtt
- name: Copy serial2mqtt default file
ansible.builtin.copy:
src: files/serial2mqtt/serial2mqtt.default
dest: /etc/default/serial2mqtt
mode: '0644'
- name: Copy serial2mqtt service unit
ansible.builtin.copy:
src: files/serial2mqtt/serial2mqtt.service
dest: /etc/systemd/system/serial2mqtt.service
mode: '0644'
- name: Start serial2mqtt service
ansible.builtin.systemd:
name: serial2mqtt.service
daemon_reload: true
state: restarted
enabled: true