ansible/roles/noodlehub/tasks/main.yml

74 lines
1.5 KiB
YAML
Raw Normal View History

---
- name: Install dependencies
apt:
name:
- python3-pip
- python3-virtualenv
- gpiod
- python3-libgpiod
- git
- name: Create group
group:
name: "{{ noodlehub_user }}"
- name: Create user
user:
name: "{{ noodlehub_user }}"
group: "{{ noodlehub_group }}"
home: /home/{{ noodlehub_user }}
groups:
- gpio
- name: Create directory
file:
owner: "{{ noodlehub_user }}"
group: "{{ noodlehub_group }}"
path: "{{ noodlehub_dir }}"
state: directory
- name: Clone noodlehub repository
git:
repo: https://github.com/binary-kitchen/noodle_hub.git
version: devel
dest: "{{ noodlehub_dir }}"
update: true
become: true
become_user: "{{ noodlehub_user }}"
- name: Create virtualenv and install python dependencies
pip:
name:
- pyyaml
- flask
- jinja2
- paho-mqtt
- utils
virtualenv: "{{ noodlehub_venv }}"
become: true
become_user: "{{ noodlehub_user }}"
- name: Configure vhost
template: src=nginx_vhost.j2 dest=/etc/nginx/sites-available/noodlehub
notify: Restart nginx
- name: Enable vhost
file: src=/etc/nginx/sites-available/noodlehub dest=/etc/nginx/sites-enabled/noodlehub state=link
notify: Restart nginx
- name: Install systemd unit file
template:
src: noodlehub.service.j2
dest: /usr/lib/systemd/system/noodlehub.service
notify: Reload systemd
- name: Enable noodlehub
service:
name: noodlehub
enabled: yes
state: started