ansible/octoprint.yml

47 lines
1.1 KiB
YAML

---
- name: install octoprint
hosts: prusa
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
state: started