update octoprint role
Signed-off-by: Thomas Schmid <tom@lfence.de>
This commit is contained in:
parent
dc55147030
commit
2adfd65c79
61
host_vars/cannelloni.binary.kitchen
Normal file
61
host_vars/cannelloni.binary.kitchen
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
mainsail_domain: cannelloni.binary.kitchen
|
||||||
|
|
||||||
|
octoprint_groups:
|
||||||
|
- klipper
|
||||||
|
- tty
|
||||||
|
|
||||||
|
octoprint_config_display_name: Voron 2.4
|
||||||
|
octoprint_domain: cannelloni.binary.kitchen
|
||||||
|
octoprint_config_default_profile: _voron_2_4
|
||||||
|
octoprint_has_webcam: false
|
||||||
|
|
||||||
|
octoprint_additional_plugins:
|
||||||
|
- "https://github.com/thelastWallE/OctoprintKlipperPlugin/archive/master.zip"
|
||||||
|
|
||||||
|
octoprint_config:
|
||||||
|
plugins:
|
||||||
|
klipper:
|
||||||
|
configuration:
|
||||||
|
config_path: /etc/klipper/
|
||||||
|
confirm_reload: false
|
||||||
|
serial:
|
||||||
|
disconnectOnErrors: false
|
||||||
|
port: /home/klipper/printer
|
||||||
|
additionalPorts:
|
||||||
|
- /home/klipper/printer
|
||||||
|
|
||||||
|
|
||||||
|
octoprint_printer_profiles:
|
||||||
|
- axes:
|
||||||
|
e:
|
||||||
|
inverted: false
|
||||||
|
speed: 300
|
||||||
|
x:
|
||||||
|
inverted: false
|
||||||
|
speed: 6000
|
||||||
|
y:
|
||||||
|
inverted: false
|
||||||
|
speed: 6000
|
||||||
|
z:
|
||||||
|
inverted: false
|
||||||
|
speed: 200
|
||||||
|
color: default
|
||||||
|
extruder:
|
||||||
|
count: 1
|
||||||
|
nozzleDiameter: 0.4
|
||||||
|
offsets:
|
||||||
|
- - 0.0
|
||||||
|
- 0.0
|
||||||
|
sharedNozzle: false
|
||||||
|
heatedBed: true
|
||||||
|
heatedChamber: false
|
||||||
|
id: _voron_2_4
|
||||||
|
model: Voron 2.4
|
||||||
|
name: Voron 2.4
|
||||||
|
volume:
|
||||||
|
custom_box: false
|
||||||
|
depth: 350.0
|
||||||
|
formFactor: rectangular
|
||||||
|
height: 320.0
|
||||||
|
origin: lowerleft
|
||||||
|
width: 350.0
|
@ -1,45 +0,0 @@
|
|||||||
octoprint_display_name: Prusa Mini
|
|
||||||
octoprint_domain: canneloni.binary.kitchen
|
|
||||||
|
|
||||||
octoprint_config_default_profile: _mini
|
|
||||||
|
|
||||||
octoprint_printer_profiles:
|
|
||||||
- axes:
|
|
||||||
e:
|
|
||||||
inverted: false
|
|
||||||
speed: 300
|
|
||||||
x:
|
|
||||||
inverted: false
|
|
||||||
speed: 6000
|
|
||||||
y:
|
|
||||||
inverted: false
|
|
||||||
speed: 6000
|
|
||||||
z:
|
|
||||||
inverted: false
|
|
||||||
speed: 200
|
|
||||||
color: default
|
|
||||||
extruder:
|
|
||||||
count: 1
|
|
||||||
nozzleDiameter: 0.4
|
|
||||||
offsets:
|
|
||||||
- - 0.0
|
|
||||||
- 0.0
|
|
||||||
sharedNozzle: false
|
|
||||||
heatedBed: true
|
|
||||||
heatedChamber: false
|
|
||||||
id: _mini
|
|
||||||
model: Prusa Mini
|
|
||||||
name: Pursa Mini
|
|
||||||
volume:
|
|
||||||
custom_box:
|
|
||||||
x_min: 0
|
|
||||||
x_max: 180
|
|
||||||
y_min: -3
|
|
||||||
y_max: 180
|
|
||||||
z_min: 0
|
|
||||||
z_max: 180
|
|
||||||
depth: 180.0
|
|
||||||
formFactor: rectangular
|
|
||||||
height: 180.0
|
|
||||||
origin: lowerleft
|
|
||||||
width: 180
|
|
@ -1,7 +1,16 @@
|
|||||||
octoprint_display_name: Voron 2.4
|
octoprint_config_display_name: Prusa Mini
|
||||||
octoprint_domain: maccaroni.binary.kitchen
|
octoprint_domain: maccaroni.binary.kitchen
|
||||||
|
octoprint_config_default_profile: _mini
|
||||||
|
|
||||||
octoprint_config_default_profile: _voron_2_4
|
octoprint_has_webcam: true
|
||||||
|
octoprint_ustreamer_args: "-r 1280x720"
|
||||||
|
|
||||||
|
octoprint_config:
|
||||||
|
webcam:
|
||||||
|
ffmpeg: "/usr/bin/ffmpeg"
|
||||||
|
snapshot: "http://{{ octoprint_domain }}/webcam/snapshot"
|
||||||
|
stream: "http://{{ octoprint_domain }}/webcam/stream"
|
||||||
|
watermark: false
|
||||||
|
|
||||||
octoprint_printer_profiles:
|
octoprint_printer_profiles:
|
||||||
- axes:
|
- axes:
|
||||||
@ -27,13 +36,19 @@ octoprint_printer_profiles:
|
|||||||
sharedNozzle: false
|
sharedNozzle: false
|
||||||
heatedBed: true
|
heatedBed: true
|
||||||
heatedChamber: false
|
heatedChamber: false
|
||||||
id: _voron_2_4
|
id: _mini
|
||||||
model: Voron 2.4
|
model: Prusa Mini
|
||||||
name: Voron 2.4
|
name: Pursa Mini
|
||||||
volume:
|
volume:
|
||||||
custom_box: false
|
custom_box:
|
||||||
depth: 350.0
|
x_min: 0
|
||||||
|
x_max: 180
|
||||||
|
y_min: -3
|
||||||
|
y_max: 180
|
||||||
|
z_min: 0
|
||||||
|
z_max: 180
|
||||||
|
depth: 180.0
|
||||||
formFactor: rectangular
|
formFactor: rectangular
|
||||||
height: 320.0
|
height: 180.0
|
||||||
origin: lowerleft
|
origin: lowerleft
|
||||||
width: 350.0
|
width: 180
|
1
host_vars/noodlehub.binary.kitchen
Normal file
1
host_vars/noodlehub.binary.kitchen
Normal file
@ -0,0 +1 @@
|
|||||||
|
noodlehub_domain: noodlehub.binary.kitchen
|
@ -1,70 +0,0 @@
|
|||||||
octoprint_domain: raspberrypi.fritz.box
|
|
||||||
octoprint_config_default_profile: _mk3_single
|
|
||||||
|
|
||||||
octoprint_printer_profiles:
|
|
||||||
- axes:
|
|
||||||
e:
|
|
||||||
inverted: false
|
|
||||||
speed: 300
|
|
||||||
x:
|
|
||||||
inverted: false
|
|
||||||
speed: 6000
|
|
||||||
y:
|
|
||||||
inverted: false
|
|
||||||
speed: 6000
|
|
||||||
z:
|
|
||||||
inverted: false
|
|
||||||
speed: 200
|
|
||||||
color: default
|
|
||||||
extruder:
|
|
||||||
count: 1
|
|
||||||
nozzleDiameter: 0.4
|
|
||||||
offsets:
|
|
||||||
- - 0.0
|
|
||||||
- 0.0
|
|
||||||
sharedNozzle: false
|
|
||||||
heatedBed: true
|
|
||||||
heatedChamber: false
|
|
||||||
id: _mk3_single
|
|
||||||
model: Prusa i3 Mk3s
|
|
||||||
name: Prusa i3 Mk3s
|
|
||||||
volume:
|
|
||||||
custom_box: false
|
|
||||||
depth: 200.0
|
|
||||||
formFactor: rectangular
|
|
||||||
height: 200.0
|
|
||||||
origin: lowerleft
|
|
||||||
width: 200.0
|
|
||||||
- axes:
|
|
||||||
e:
|
|
||||||
inverted: false
|
|
||||||
speed: 300
|
|
||||||
x:
|
|
||||||
inverted: false
|
|
||||||
speed: 6000
|
|
||||||
y:
|
|
||||||
inverted: false
|
|
||||||
speed: 6000
|
|
||||||
z:
|
|
||||||
inverted: false
|
|
||||||
speed: 200
|
|
||||||
color: default
|
|
||||||
extruder:
|
|
||||||
count: 5
|
|
||||||
nozzleDiameter: 0.4
|
|
||||||
offsets:
|
|
||||||
- - 0.0
|
|
||||||
- 0.0
|
|
||||||
sharedNozzle: true
|
|
||||||
heatedBed: true
|
|
||||||
heatedChamber: false
|
|
||||||
id: _mk3_mmu
|
|
||||||
model: Prusa i3 Mk3s
|
|
||||||
name: Pursa i3 Mk3s with MMU
|
|
||||||
volume:
|
|
||||||
custom_box: false
|
|
||||||
depth: 200.0
|
|
||||||
formFactor: rectangular
|
|
||||||
height: 200.0
|
|
||||||
origin: lowerleft
|
|
||||||
width: 200.0
|
|
@ -1,7 +1,16 @@
|
|||||||
octoprint_display_name: Prusa MK3s
|
octoprint_config_display_name: Prusa MK3s
|
||||||
octoprint_domain: spaghetti.binary.kitchen
|
octoprint_domain: spaghetti.binary.kitchen
|
||||||
|
|
||||||
octoprint_config_default_profile: _mk3_single
|
octoprint_config_default_profile: _mk3_single
|
||||||
|
octoprint_has_webcam: true
|
||||||
|
octoprint_ustreamer_args: "-r 1280x720"
|
||||||
|
|
||||||
|
octoprint_config:
|
||||||
|
webcam:
|
||||||
|
ffmpeg: "/usr/bin/ffmpeg"
|
||||||
|
snapshot: "http://{{ octoprint_domain }}/webcam/snapshot"
|
||||||
|
stream: "http://{{ octoprint_domain }}/webcam/stream"
|
||||||
|
watermark: false
|
||||||
|
|
||||||
|
|
||||||
octoprint_printer_profiles:
|
octoprint_printer_profiles:
|
||||||
- axes:
|
- axes:
|
||||||
|
11
hosts
11
hosts
@ -1,8 +1,13 @@
|
|||||||
[3D_Printers_test]
|
noodlehub.binary.kitchen
|
||||||
raspberrypi
|
|
||||||
|
[3D_Printers]
|
||||||
|
spaghetti.binary.kitchen
|
||||||
|
maccaroni.binary.kitchen
|
||||||
|
#canneloni.binary.kitchen
|
||||||
|
|
||||||
|
|
||||||
[Octoprint_hosts]
|
[Octoprint_hosts]
|
||||||
spaghetti.binary.kitchen
|
spaghetti.binary.kitchen
|
||||||
maccaroni.binary.kitchen
|
maccaroni.binary.kitchen
|
||||||
canneloni.binary.kitchen
|
cannelloni.binary.kitchen
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ http {
|
|||||||
types_hash_max_size 2048;
|
types_hash_max_size 2048;
|
||||||
server_tokens off;
|
server_tokens off;
|
||||||
|
|
||||||
# server_names_hash_bucket_size 64;
|
server_names_hash_bucket_size 64;
|
||||||
# server_name_in_redirect off;
|
# server_name_in_redirect off;
|
||||||
|
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
octoprint_user: octoprint
|
octoprint_user: octoprint
|
||||||
octoprint_group: octoprint
|
octoprint_group: octoprint
|
||||||
octoprint_dir: "/opt/octoprint"
|
octoprint_dir: "/opt/octoprint"
|
||||||
|
octoprint_conf_dir: "/home/{{ octoprint_user }}"
|
||||||
octoprint_ssl: false
|
octoprint_ssl: false
|
||||||
|
octoprint_has_webcam: false
|
||||||
|
|
||||||
|
octoprint_default_plugins:
|
||||||
|
- "https://github.com/OctoPrint/OctoPrint-MQTT/archive/master.zip"
|
||||||
|
|
||||||
octoprint_config_salt: "{{ octoprint_salt }}"
|
octoprint_config_salt: "{{ octoprint_salt }}"
|
||||||
octoprint_config_api_key: "{{ octoprint_api_key}}"
|
octoprint_config_api_key: "{{ octoprint_api_key}}"
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
axes:
|
|
||||||
e:
|
|
||||||
inverted: false
|
|
||||||
speed: 300
|
|
||||||
x:
|
|
||||||
inverted: false
|
|
||||||
speed: 6000
|
|
||||||
y:
|
|
||||||
inverted: false
|
|
||||||
speed: 6000
|
|
||||||
z:
|
|
||||||
inverted: false
|
|
||||||
speed: 200
|
|
||||||
color: default
|
|
||||||
extruder:
|
|
||||||
count: 1
|
|
||||||
nozzleDiameter: 0.4
|
|
||||||
offsets:
|
|
||||||
- - 0.0
|
|
||||||
- 0.0
|
|
||||||
sharedNozzle: false
|
|
||||||
heatedBed: true
|
|
||||||
heatedChamber: false
|
|
||||||
id: _default
|
|
||||||
model: Generic RepRap Printer
|
|
||||||
name: Default
|
|
||||||
volume:
|
|
||||||
custom_box: false
|
|
||||||
depth: 200.0
|
|
||||||
formFactor: rectangular
|
|
||||||
height: 200.0
|
|
||||||
origin: lowerleft
|
|
||||||
width: 200.0
|
|
@ -1,12 +0,0 @@
|
|||||||
binarykitchen:
|
|
||||||
active: true
|
|
||||||
apikey: null
|
|
||||||
groups:
|
|
||||||
- users
|
|
||||||
- admins
|
|
||||||
password: fb5adb1fbecb856f2f37da607ea17faf4887cb353b0d28459b12fb814b59d325825b7856d604efddf30b7b0a08e95af0b5a78d6912830bac171d84fe0d8d2a33
|
|
||||||
permissions: []
|
|
||||||
roles:
|
|
||||||
- user
|
|
||||||
- admin
|
|
||||||
settings: {}
|
|
@ -6,3 +6,6 @@
|
|||||||
|
|
||||||
- name: Restart nginx
|
- name: Restart nginx
|
||||||
service: name=nginx state=restarted
|
service: name=nginx state=restarted
|
||||||
|
|
||||||
|
- name: Restart ustreamer
|
||||||
|
service: name=ustreamer state=restarted
|
@ -12,6 +12,14 @@
|
|||||||
append: yes
|
append: yes
|
||||||
groups:
|
groups:
|
||||||
- video
|
- video
|
||||||
|
- dialout
|
||||||
|
|
||||||
|
- name: Add octoprint user to additional groups
|
||||||
|
user:
|
||||||
|
name: "{{ octoprint_user }}"
|
||||||
|
append: yes
|
||||||
|
groups: "{{ octoprint_groups }}"
|
||||||
|
when: octoprint_groups is defined
|
||||||
|
|
||||||
- name: Install requirements
|
- name: Install requirements
|
||||||
apt:
|
apt:
|
||||||
@ -19,10 +27,38 @@
|
|||||||
- python3-pip
|
- python3-pip
|
||||||
- python3-virtualenv
|
- python3-virtualenv
|
||||||
|
|
||||||
|
- name: Create octoprint directory
|
||||||
|
file:
|
||||||
|
path: "{{ octoprint_dir }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ octoprint_user }}"
|
||||||
|
group: "{{ octoprint_group }}"
|
||||||
|
|
||||||
- name: Create virtual env and install python dependencies
|
- name: Create virtual env and install python dependencies
|
||||||
pip:
|
pip:
|
||||||
name: octoprint
|
name: octoprint
|
||||||
virtualenv: "{{ octoprint_dir }}"
|
virtualenv: "{{ octoprint_dir }}"
|
||||||
|
become: true
|
||||||
|
become_user: "{{ octoprint_user }}"
|
||||||
|
|
||||||
|
- name: Install default octoprint plugins
|
||||||
|
pip:
|
||||||
|
name: "{{ item }}"
|
||||||
|
virtualenv: "{{ octoprint_dir }}"
|
||||||
|
become: true
|
||||||
|
become_user: "{{ octoprint_user }}"
|
||||||
|
with_items: "{{ octoprint_default_plugins }}"
|
||||||
|
notify: Restart octoprint
|
||||||
|
|
||||||
|
- name: Install additional octoprint plugins
|
||||||
|
pip:
|
||||||
|
name: "{{ item }}"
|
||||||
|
virtualenv: "{{ octoprint_dir }}"
|
||||||
|
become: true
|
||||||
|
become_user: "{{ octoprint_user }}"
|
||||||
|
with_items: "{{ octoprint_additional_plugins }}"
|
||||||
|
when: octoprint_additional_plugins is defined
|
||||||
|
notify: Restart octoprint
|
||||||
|
|
||||||
- name: Create configuration directories
|
- name: Create configuration directories
|
||||||
file:
|
file:
|
||||||
@ -34,6 +70,8 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- .octoprint
|
- .octoprint
|
||||||
- .octoprint/printerProfiles
|
- .octoprint/printerProfiles
|
||||||
|
- .octoprint/data
|
||||||
|
- .octoprint/data/appkeys
|
||||||
|
|
||||||
- name: Install systemd unit
|
- name: Install systemd unit
|
||||||
template: src=octoprint.service.j2 dest=/lib/systemd/system/octoprint.service
|
template: src=octoprint.service.j2 dest=/lib/systemd/system/octoprint.service
|
||||||
@ -59,28 +97,39 @@
|
|||||||
octoprint_config_combined: "{{ octoprint_default_config | combine(octoprint_config, recursive=True)}}"
|
octoprint_config_combined: "{{ octoprint_default_config | combine(octoprint_config, recursive=True)}}"
|
||||||
when: octoprint_config is defined
|
when: octoprint_config is defined
|
||||||
|
|
||||||
- name: Initial configuration of octoprint
|
- name: Apply user config
|
||||||
copy:
|
set_fact:
|
||||||
content: "{{ octoprint_config_combined | to_nice_yaml }}"
|
octoprint_config_combined: "{{ octoprint_default_config }}"
|
||||||
dest: "/home/{{ octoprint_user }}/.octoprint/config.yaml"
|
when: octoprint_config is not defined
|
||||||
when: not octoprint_register_config_stat.stat.exists
|
|
||||||
|
|
||||||
- name: Update existing Octoprint configuration
|
|
||||||
|
- name: Configure Octoprint
|
||||||
block:
|
block:
|
||||||
- name: Read Octoprint config file
|
- name: Initial configuration of octoprint
|
||||||
slurp:
|
|
||||||
src: "/home/{{ octoprint_user }}/.octoprint/config.yaml"
|
|
||||||
register: octoprint_register_config
|
|
||||||
|
|
||||||
- name: Parse Octoprint config file
|
|
||||||
set_fact:
|
|
||||||
current_octoprint_config: "{{ octoprint_register_config['content'] | b64decode | from_yaml}}"
|
|
||||||
|
|
||||||
- name: Write updated octoprint configuration
|
|
||||||
copy:
|
copy:
|
||||||
content: "{{ current_octoprint_config | combine(octoprint_config_combined, recursive=True) | to_nice_yaml}}"
|
content: "{{ octoprint_config_combined | to_nice_yaml }}"
|
||||||
dest: "/home/{{octoprint_user}}/.octoprint/config.yaml"
|
dest: "/home/{{ octoprint_user }}/.octoprint/config.yaml"
|
||||||
notify: Restart octoprint
|
when: not octoprint_register_config_stat.stat.exists
|
||||||
|
|
||||||
|
- name: Update existing Octoprint configuration
|
||||||
|
block:
|
||||||
|
- name: Read Octoprint config file
|
||||||
|
slurp:
|
||||||
|
src: "/home/{{ octoprint_user }}/.octoprint/config.yaml"
|
||||||
|
register: octoprint_register_config
|
||||||
|
|
||||||
|
- name: Parse Octoprint config file
|
||||||
|
set_fact:
|
||||||
|
current_octoprint_config: "{{ octoprint_register_config['content'] | b64decode | from_yaml}}"
|
||||||
|
|
||||||
|
- name: Write updated octoprint configuration
|
||||||
|
copy:
|
||||||
|
content: "{{ current_octoprint_config | combine(octoprint_config_combined, recursive=True) | to_nice_yaml}}"
|
||||||
|
dest: "/home/{{octoprint_user}}/.octoprint/config.yaml"
|
||||||
|
notify: Restart octoprint
|
||||||
|
when: octoprint_register_config_stat.stat.exists
|
||||||
|
become: true
|
||||||
|
become_user: "{{ octoprint_user }}"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Octoprint printer configuration
|
# Octoprint printer configuration
|
||||||
@ -91,48 +140,110 @@
|
|||||||
content: "{{ item | to_nice_yaml}}"
|
content: "{{ item | to_nice_yaml}}"
|
||||||
dest: "/home/{{ octoprint_user }}/.octoprint/printerProfiles/{{item.id}}.profile"
|
dest: "/home/{{ octoprint_user }}/.octoprint/printerProfiles/{{item.id}}.profile"
|
||||||
loop: "{{ octoprint_printer_profiles }}"
|
loop: "{{ octoprint_printer_profiles }}"
|
||||||
|
become: true
|
||||||
|
become_user: "{{ octoprint_user }}"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Octoprint Users
|
# Octoprint Users
|
||||||
################################################################################
|
################################################################################
|
||||||
|
- name: Setup octoprint users
|
||||||
when: octoprint_register_config_stat.stat.exists
|
|
||||||
|
|
||||||
- name: Register if user databse already exists on target host
|
|
||||||
stat:
|
|
||||||
path: "/home/{{ octoprint_user }}/.octoprint.users.yaml"
|
|
||||||
register: octoprint_register_users
|
|
||||||
|
|
||||||
- name: Read default octoprint users
|
|
||||||
set_fact:
|
|
||||||
octoprint_defaut_users: "{{ lookup('file', 'users.yaml') | from_yaml }}"
|
|
||||||
|
|
||||||
- name: Copy default users
|
|
||||||
copy:
|
|
||||||
src: users.yaml
|
|
||||||
dest: "/home/{{ octoprint_user }}/.octoprint/users.yaml"
|
|
||||||
when: not octoprint_register_users.stat.exists
|
|
||||||
|
|
||||||
- name: Merge users database with default users
|
|
||||||
block:
|
block:
|
||||||
- name: Read Octoprint users file
|
- name: Register if user databse already exists on target host
|
||||||
slurp:
|
stat:
|
||||||
src: "/home/{{ octoprint_user }}/.octoprint/users.yaml"
|
path: "/home/{{ octoprint_user }}/.octoprint.users.yaml"
|
||||||
register: octoprint_register_users_file
|
register: octoprint_register_users
|
||||||
|
|
||||||
- name: Parse Octoprint users file
|
- name: Copy default users
|
||||||
set_fact:
|
|
||||||
current_octoprint_users: "{{ octoprint_register_users_file['content'] | b64decode | from_yaml }}"
|
|
||||||
|
|
||||||
- name: Merge current users with default users
|
|
||||||
set_fact:
|
|
||||||
octoprint_users_db: "{{ current_octoprint_users | combine(octoprint_default_users)}}"
|
|
||||||
|
|
||||||
- name: Copy new users file
|
|
||||||
copy:
|
copy:
|
||||||
content: "{{ octoprint_users_db | to_nice_yaml }}"
|
content: "{{ octoprint_users_list | to_nice_yaml }}"
|
||||||
dest: "/home/{{ octoprint_user }}/.octoprint.users.yaml"
|
dest: "/home/{{ octoprint_user }}/.octoprint/users.yaml"
|
||||||
when: octoprint_register_users.stat.exists
|
when: not octoprint_register_users.stat.exists
|
||||||
|
|
||||||
|
- name: Merge users database with default users
|
||||||
|
block:
|
||||||
|
- name: Read Octoprint users file
|
||||||
|
slurp:
|
||||||
|
src: "/home/{{ octoprint_user }}/.octoprint/users.yaml"
|
||||||
|
register: octoprint_register_users_file
|
||||||
|
|
||||||
|
- name: Parse Octoprint users file
|
||||||
|
set_fact:
|
||||||
|
current_octoprint_users: "{{ octoprint_register_users_file['content'] | b64decode | from_yaml }}"
|
||||||
|
|
||||||
|
- name: Merge current users with default users
|
||||||
|
set_fact:
|
||||||
|
octoprint_users_db: "{{ current_octoprint_users | combine(octoprint_users_list)}}"
|
||||||
|
|
||||||
|
- name: Copy new users file
|
||||||
|
copy:
|
||||||
|
content: "{{ octoprint_users_db | to_nice_yaml }}"
|
||||||
|
dest: "/home/{{ octoprint_user }}/.octoprint/users.yaml"
|
||||||
|
when: octoprint_register_users.stat.exists
|
||||||
|
when: octoprint_users_list is defined
|
||||||
|
become: true
|
||||||
|
become_user: "{{ octoprint_user }}"
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Octoprint app keys
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
- name: Install application keys
|
||||||
|
block:
|
||||||
|
- name: Register existing app keys
|
||||||
|
stat:
|
||||||
|
path: /home/{{ octoprint_user }}/.octoprint/data/appkeys/keys.yaml
|
||||||
|
register: app_keys_file
|
||||||
|
|
||||||
|
- name: Read existing app keys
|
||||||
|
slurp:
|
||||||
|
src: /home/{{ octoprint_user }}/.octoprint/data/appkeys/keys.yaml
|
||||||
|
register: existing_app_keys_content
|
||||||
|
when: app_keys_file.stat.exists
|
||||||
|
|
||||||
|
- name: Combine local and remote app keys
|
||||||
|
set_fact:
|
||||||
|
app_keys_combined: "{{ existing_app_keys_content['content'] | b64decode | from_yaml | combine(octoprint_app_keys ,recursive=True) }}"
|
||||||
|
when: app_keys_file.stat.exists
|
||||||
|
|
||||||
|
- name: Copy default app keys
|
||||||
|
copy:
|
||||||
|
content: "{{ app_keys_combined | to_nice_yaml }}"
|
||||||
|
dest: /home/{{ octoprint_user }}/.octoprint/data/appkeys/keys.yaml
|
||||||
|
when: app_keys_file.stat.exists
|
||||||
|
|
||||||
|
- name: Copy default app keys
|
||||||
|
copy:
|
||||||
|
content: "{{ octoprint_app_keys | to_nice_yaml }}"
|
||||||
|
dest: /home/{{ octoprint_user }}/.octoprint/data/appkeys/keys.yaml
|
||||||
|
when: not app_keys_file.stat.exists
|
||||||
|
when: octoprint_app_keys is defined
|
||||||
|
notify: Restart octoprint
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Webcam
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
- name: Setup webcam
|
||||||
|
block:
|
||||||
|
- name: Install dependencies
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- ffmpeg
|
||||||
|
- ustreamer
|
||||||
|
|
||||||
|
- name: Install systemd unit
|
||||||
|
template: src=ustreamer.service.j2 dest=/lib/systemd/system/ustreamer.service
|
||||||
|
notify:
|
||||||
|
- Reload systemd
|
||||||
|
- Restart ustreamer
|
||||||
|
|
||||||
|
- name: Enable and start ustreamer
|
||||||
|
service:
|
||||||
|
name: ustreamer
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
when: octoprint_has_webcam
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Reverse proxy
|
# Reverse proxy
|
||||||
@ -161,6 +272,7 @@
|
|||||||
- name: Enable octoprint
|
- name: Enable octoprint
|
||||||
service:
|
service:
|
||||||
name: octoprint
|
name: octoprint
|
||||||
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ appearance:
|
|||||||
accessControl:
|
accessControl:
|
||||||
salt: "{{ octoprint_config_salt }}"
|
salt: "{{ octoprint_config_salt }}"
|
||||||
autologinAs: binarykitchen
|
autologinAs: binarykitchen
|
||||||
|
localNetworks:
|
||||||
|
- 127.0.0.0/8
|
||||||
|
- 172.23.0.0/16
|
||||||
|
|
||||||
api:
|
api:
|
||||||
key: "{{ octoprint_config_api_key }}"
|
key: "{{ octoprint_config_api_key }}"
|
||||||
|
@ -5,6 +5,13 @@ server {
|
|||||||
|
|
||||||
server_name {{ octoprint_domain }};
|
server_name {{ octoprint_domain }};
|
||||||
|
|
||||||
|
location /webcam/ {
|
||||||
|
postpone_output 0;
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_ignore_headers X-Accel-Buffering;
|
||||||
|
proxy_pass http://localhost:8080/;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
client_max_body_size 1024M;
|
client_max_body_size 1024M;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@ -13,7 +20,6 @@ server {
|
|||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Scheme $scheme;
|
proxy_set_header X-Scheme $scheme;
|
||||||
proxy_set_header X-Script-Name /octoprint;
|
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_pass http://localhost:5000;
|
proxy_pass http://localhost:5000;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ After=network.target
|
|||||||
RestartSec=2s
|
RestartSec=2s
|
||||||
Type=simple
|
Type=simple
|
||||||
User={{ octoprint_user }}
|
User={{ octoprint_user }}
|
||||||
Group={{ octoprint_user }}
|
|
||||||
WorkingDirectory={{ octoprint_dir }}
|
WorkingDirectory={{ octoprint_dir }}
|
||||||
ExecStart={{ octoprint_dir }}/bin/octoprint serve
|
ExecStart={{ octoprint_dir }}/bin/octoprint serve
|
||||||
Restart=always
|
Restart=always
|
||||||
|
19
roles/octoprint/templates/ustreamer.service.j2
Normal file
19
roles/octoprint/templates/ustreamer.service.j2
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Ustreamer
|
||||||
|
After=syslog.target
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
RestartSec=2s
|
||||||
|
Type=simple
|
||||||
|
User={{ octoprint_user }}
|
||||||
|
Group={{ octoprint_user }}
|
||||||
|
{% if octoprint_ustreamer_args is defined %}
|
||||||
|
ExecStart=/usr/bin/ustreamer {{octoprint_ustreamer_args}}
|
||||||
|
{% else %}
|
||||||
|
ExecStart=/usr/bin/ustreamer
|
||||||
|
{% endif %}
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
3
site.yml
3
site.yml
@ -1,5 +1,5 @@
|
|||||||
- name: Setup common rules
|
- name: Setup common rules
|
||||||
hosts: [3D_Printers]
|
hosts: [3D-Printers]
|
||||||
roles:
|
roles:
|
||||||
- common
|
- common
|
||||||
- root_keys
|
- root_keys
|
||||||
@ -8,3 +8,4 @@
|
|||||||
hosts: [Octoprint_hosts]
|
hosts: [Octoprint_hosts]
|
||||||
roles:
|
roles:
|
||||||
- octoprint
|
- octoprint
|
||||||
|
tags: octoprint
|
Loading…
Reference in New Issue
Block a user