Move octoprint to role

This commit is contained in:
pgrondek 2020-05-25 23:44:21 +02:00
parent 90379a77b5
commit 6b7bb404bd
8 changed files with 67 additions and 52 deletions

View File

@ -2,3 +2,7 @@
- hosts: server - hosts: server
roles: roles:
- ssh - ssh
- hosts: prusa.lan
roles:
- octoprint

View File

@ -1,52 +0,0 @@
---
- name: install octoprint
hosts: prusa.lan
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 system-site-packages .
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
- name: enable octoprint to restart itself
copy:
src: sudoers.conf
dest: /etc/sudoers.d/octoprint
mode: 0440

View File

@ -0,0 +1,10 @@
---
- name: create octoprint account
become: yes
user:
name: octoprint
comment: Octoprint account
groups: tty,dialout
system: yes
password_lock: yes
home: /home/octoprint

View File

@ -0,0 +1,26 @@
---
- name: install needed tools
become: yes
apt:
update_cache: yes
pkg:
- python-pip
- python-dev
- python-setuptools
- python-virtualenv
- git
- libyaml-dev
- build-essential
- name: install octoprint software
become: yes
become_user: octoprint
shell:
chdir: /home/octoprint
cmd: |
virtualenv system-site-packages .
source bin/activate
pip install pip --upgrade
pip install octoprint
args:
executable: /bin/bash

View File

@ -0,0 +1,7 @@
---
- import_tasks: account.yml
- import_tasks: install.yml
- import_tasks: service.yml

View File

@ -0,0 +1,20 @@
---
- name: copy systemd service config
become: yes
copy:
src: octoprint.service
dest: /lib/systemd/system/octoprint.service
- name: enable systemd service
become: yes
systemd:
name: octoprint
enabled: yes
state: started
- name: enable octoprint to restart itself
become: yes
copy:
src: sudoers.conf
dest: /etc/sudoers.d/octoprint
mode: 0440