This repository contains ansible configuration management code for easier deployment of the ISEMS app(s).
The idea is that you use these scripts to install the isems-app (the static page app that is used to display data) and the isems-data-collector (the python application that collects data and makes it available as an api) on a raspberry pi in your network.
This tutorial assumes that you are installing the application on a rasperry pi so there should be a user called pi
on the machine that we are installing to.
Ansible works by sshing into the raspberry pi so you need to make sure that the user on the machine that you are running the ansible commands with can ssh into the raspberry pi as the pi user. To do so add your ~/.ssh/id_rsa.pub
to the raspberry pi's /home/pi/.ssh/authorized_keys
.
The ansible scripts will install some software as root, using sudo. Make sure that your pi
user can become root without password input. On the rasperry pi run visudo
on it and add this line at the end of the filepi ALL=(ALL) NOPASSWD: ALL
.
- User
pi
exists on raspberry pi - Local user can ssh into raspberry pi as pi user
-
pi
user can becomeroot
usingsudo
without password
The configuration of the application is slightly different for every installation. You will need to make some cofiguration changes.
- Edit the
hosts
file at the root of this repository and put the IP of the raspberry pi there. It could for example look like this:
[isems_raspi]
2001:bc8:600:11c::1 ansible_user=pi ansible_ssh_user=pi ansible_python_interpreter=/usr/bin/python3
- Check out the comments in
roles/flask/vars/main.yml
. To configure your preferred mode of fetching data.
To install the required dependencies, make sure you are inside a virtual environment and run:
pip install ansible
ansible-galaxy install -r requirements.yml
To deploy the application run the following command:
ansible-playbook isems.yml -i hosts