Move octoprint to role
This commit is contained in:
parent
90379a77b5
commit
6b7bb404bd
4
main.yml
4
main.yml
@ -2,3 +2,7 @@
|
|||||||
- hosts: server
|
- hosts: server
|
||||||
roles:
|
roles:
|
||||||
- ssh
|
- ssh
|
||||||
|
|
||||||
|
- hosts: prusa.lan
|
||||||
|
roles:
|
||||||
|
- octoprint
|
||||||
|
@ -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
|
|
10
roles/octoprint/tasks/account.yml
Normal file
10
roles/octoprint/tasks/account.yml
Normal 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
|
26
roles/octoprint/tasks/install.yml
Normal file
26
roles/octoprint/tasks/install.yml
Normal 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
|
7
roles/octoprint/tasks/main.yml
Normal file
7
roles/octoprint/tasks/main.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: account.yml
|
||||||
|
|
||||||
|
- import_tasks: install.yml
|
||||||
|
|
||||||
|
- import_tasks: service.yml
|
||||||
|
|
20
roles/octoprint/tasks/service.yml
Normal file
20
roles/octoprint/tasks/service.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user