2020-03-24 21:17:48 +00:00
|
|
|
---
|
|
|
|
- name: install octoprint
|
2020-04-22 20:56:53 +00:00
|
|
|
hosts: prusa.lan
|
2020-03-24 21:17:48 +00:00
|
|
|
become_method: sudo
|
|
|
|
become_user: root
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: install needed tools
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
pkg:
|
|
|
|
- python-pip
|
|
|
|
- python-dev
|
|
|
|
- python-setuptools
|
|
|
|
- python-virtualenv
|
|
|
|
- git
|
|
|
|
- libyaml-dev
|
|
|
|
- build-essential
|
|
|
|
- name: create octoprint account
|
|
|
|
user:
|
|
|
|
name: octoprint
|
|
|
|
comment: Octoprint account
|
|
|
|
groups: tty,dialout
|
|
|
|
system: yes
|
|
|
|
password_lock: yes
|
|
|
|
home: /home/octoprint
|
|
|
|
- name: install octoprint software
|
|
|
|
become_user: octoprint
|
|
|
|
shell:
|
|
|
|
chdir: /home/octoprint
|
|
|
|
cmd: |
|
|
|
|
virtualenv .
|
|
|
|
source bin/activate
|
|
|
|
pip install pip --upgrade
|
|
|
|
pip install octoprint
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
- name: copy systemd service config
|
|
|
|
copy:
|
|
|
|
src: octoprint.service
|
|
|
|
dest: /lib/systemd/system/octoprint.service
|
|
|
|
- name: enable systemd service
|
|
|
|
systemd:
|
|
|
|
name: octoprint
|
|
|
|
enabled: yes
|
2020-04-22 20:56:53 +00:00
|
|
|
state: started
|
|
|
|
- name: enable octoprint to restart itself
|
|
|
|
copy:
|
|
|
|
src: sudoers.conf
|
|
|
|
dest: /etc/sudoers.d/octoprint
|
|
|
|
mode: 0440
|